Which of the following is not a valid declaration for main
()?
1) int main()
2) int main(int argc, char *argv[])
3) They both work
Answers were Sorted based on User's Feedback
write a program to display & create a rational number
#define min((a),(b)) ((a)<(b))?(a):(b) main() { int i=0,a[20],*ptr; ptr=a; while(min(ptr++,&a[9])<&a[8]) i=i+1; printf("i=%d\n",i);}
There are N egg baskets and the number of eggs in each basket is a known quantity. Two players take turns to remove these eggs from the baskets. On each turn, a player must remove at least one egg, and may remove any number of eggs provided they all belong to the same basket. The player picking the last egg(s) wins the game. If you are allowed to decide who is going to start first, what mathematical function would you use to decide so that you end up on the winning side?
write a function that accepts an integer/char array and an search item.If the search item is there in the array return position of array and value else return -1.without using other array,without sorting,not to use more than one loop?
What is memory leak in c?
Is it acceptable to declare/define a variable in a c header?
what is difference between ++(*p) and (*p)++
17 Answers Accenture, HCL, IBM,
What are signals in C?
how does printf function work
I use turbo C which allocates 2 bytes for integers and 4 bytes for long. I tried to declare array of size 500000 of long type using the following code... long *arr; arr=(long *)(malloc)(500000 * sizeof(long)); It gives a warning that "Conversion may lose significant digits in function main"... And the resulting array size was very less around 8400 as compared to 500000. Any suggestions will be welcomed....
Explain how can I remove the trailing spaces from a string?
What is dynamic dispatch in c++?