thats the worry.. the compiler doesnt throw any error. my question is why doesnt it throw any error.
main()
{
int a[];
}
throws an error empty array declaration whereas the same thing declared in function definition as part of its arguments doesnt throw any such error!!...
User Profile
Collapse
-
Empty array as argument to a function in C
Hi all,
An empty array declared in a called function is used as a pointer to hold the address of an object passed in the calling function. this is perfectly legal.
{/*calling function*/
...
my_function(&in t_variable);
...
}
/*my function definition*/
my_function(int i[])
{
......
}
my question is why doesnt the compiler... -
'A member which doesnt represent a bit field"=>
Point1:
doesn't this imply the other members which can be defined in a structure like predefined datatypes like int,char, and user-defined ones like structures, unions etc?
Point2:
If something(membe rs of a structure other than bit feilds) is defined by negating its opposite(in this case bit feild),then that definition(qual ifying) is not applicable to its...Leave a comment:
-
It says a bit field cannot be qualified with either of the qualifiers....Leave a comment:
-
Structure member lvalue
Hi all,
I was going through one article on Structures and Unions on net. I found this statement. Couldn't understand what it means.. Can anyone explain me what it means if it makes sense.
----------------------------------------------------------------------------------------------------------------
' A member that does not represent a bit field can be qualified with either of the type qualifiers volatile or const.... -
-
Alright. Please consider this example.
void main()
{
int x=4;
func(x,x++);
}
func(int x, int y)
{
/*Some definition*/
printf("%d\t%d\ n",x,y);
}
-----------------------------------------------------------------------------------------------------------------
My concern was about the statement which i quoted in my prevoius post.According to it, the...Leave a comment:
-
-
Postfix and Prefix operator with respect to functions
Hi,
In http://elearning.embnet.org/file.php...---and---.html I read about postfix and prefix unary operators.
It said " If the increment or decrement operator is used as a prefix, the operation is performed before the function call. If the operator is used as a postfix, the operation is performed after the function call. "
So accordingly
int x=4;
... -
I am very sorry about it... :)
Yeah u very right...
long
int
short
char
char
Gives 12 bytes.
RegardsLeave a comment:
-
.bin files are the executables you get after compiling(inclu des linking) any programming code....Leave a comment:
-
You said the best way to minimize the number of padding bytes, the structure members should be declared in the descending order of their sizes.
I executed a structure declared its members in the follwoing orders.
char,short,int, char,long 16 bytes(structure size)
long,short,char ,char,int 12 bytes
char,long,char, short,int 20 bytes
long, short,int,char, char 16 bytes
char,char,short ,int,long 12 bytes...Leave a comment:
-
Banfa,
Thanks again.
Request you to exaplin me the terminologies:
2 byte aligned
4 byte aligned
I understand that '2 byte aligned' means, a data type whose size is 2-bytes, has to be stored in memory only at even addresses(inclu ding 0) like 2,4,6....
4 byte aligned, means a data type whose size is 4-bytes has to be stored at memory addresses which are multiples of 4(including 0)....Leave a comment:
-
Hi,
No I would want to finish the entire code in one line
int x=2,y=3;
return(x=2*y, y=x*x);
it would return 36 and not 4 because the expression in ( ) of return statement evaluates from left to right because of comma operator. That was my intention.
regards
SwapnaLeave a comment:
-
Hi
Explanation well understood. Thanks.
But padding of bytes create 'holes' and block memory usage.What do u have to say on this?
Regards
SwapnaLeave a comment:
-
Purpose of Structure Alignment Rules
Hi,
I would like to know why structure alignment rules were introduced.
How does a structure with/without boundary alignments differ.
Regards
Swapna -
Hi, Thank u for the relpy but could you please elaborate on your solution....Leave a comment:
-
Progress Bar for unknown time
Hi,
I have an application that writes data from PC to a 8052 microcontroller 's Flash.
It takes an accountable amount of time.I want to show a progress bar for the same but i cannt quantify the time(time it takes to complete writing all bytes to the falsh).I have an idea on progress bars with minimum and maximum limits known.I would like to know for unknown situation like my application
Can anyone please give me kick start tips... -
Hey,
Thanks for the reply.Scenario with multiple expressions seperated by comma for eg:return(x=2y, y=x*x) something like this where x and y are static variables.
y=x*x will be evaluated ?
Thanks...Leave a comment:
-
return statement
Can anyone explain me the output of the following code
char *rev(int val);
void main()
{
extern char dec[];
printf("%c", *rev);
}
char *rev(int val)
{
char dec[]="abcde";
return dec;
}
No activity results to display
Show More
Leave a comment: