473,399 Members | 4,254 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

f(int i) declaration, f(const int i) definition?

We were working through one of Sutter's books this lunch time, and it
came about that you can put a function:

void f(int i); // in the header file

and

void f(const int i) {} // as the definition.

My question is: is that correct? Isn't the type const int different
from just int? I presume that inside function f, one could not change
i if it's marked as const in the declaration, even if its marked so
ONLY in the declaration.

-Thanks for reading!
-Dean
Mar 27 '08 #1
0 1035

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Razvan | last post by:
Hi ! Consider the following XML element: <!ELEMENT value (#PCDATA)> <!ATTLIST value year CDATA #IMPLIED>
8
by: newmans | last post by:
Perhaps one of the experts can straighten me out on this point... In Bjarne Stroustrup's book 'The C++ Programming Language' 3rd Edition, section 4.9, indicates that typedef complex<short>...
2
by: xllx.relient.xllx | last post by:
I have a few quetions about definitions vs declarations concerning defined types (user defined), specifically classes. From what I understand, a class contained in a header file is a definition as...
8
by: caferias | last post by:
Hello, I'm curious about the difference between the term "declaration" and "definition" in the context of XML. Where is the difference? Greetings: Fernando
9
by: Jess | last post by:
Hello, I was told that if I declare a static class constant like this: class A{ static const int x = 10; }; then the above statement is a declaration rather than a definition. As I've...
6
by: Suyash Upadhyay | last post by:
Hello all, I am despondent to handle difference between declaration and definition of a variable. I have been totally confused. Please help me, Thanx in advance Suyash
1
by: wtu | last post by:
function Declaration&Definition -------------------------------------------------------------------------------- " Geroty (const vector<Point3D>& poly, const Plane& Tr)" As i'm c++ beginner...
15
by: vaib | last post by:
hi to all.i'd like to know the actual difference between variable declaration and definition.it would be very helpful if anyone out there wud help me out with this thing.i'm writing here after here...
5
by: arun121185 | last post by:
I have been studying c language in depth and i could not find the difference between declaration and definition. my lecturers said when a variable is decleared space will be alloted for that...
5
by: pgupta0609 | last post by:
if i write a statement in C/C++.......... main() { int x; } is this a declaration or definition? if...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.