Is there any difference between the two declarations,

1. int foo(int *arr[]) and

2. int foo(int *arr[2])



Is there any difference between the two declarations, 1. int foo(int *arr[]) and 2. int foo(i..

Answer / susie

Answer :

No

Explanation:

Functions can only pass pointers and not arrays. The numbers
that are allowed inside the [] is just for more readability.
So there is no difference between the two declarations.

Is This Answer Correct ?    1 Yes 6 No

Post New Answer

More C Code Interview Questions

Write a c program to search an element in an array using recursion

1 Answers   Wipro,


main() { int i=10,j=20; j = i, j?(i,j)?i:j:j; printf("%d %d",i,j); }

2 Answers   Adobe, CSC,


main() { char p[ ]="%d\n"; p[1] = 'c'; printf(p,65); }

2 Answers  


main() { int i, n; char *x = “girl”; n = strlen(x); *x = x[n]; for(i=0; i<n; ++i) { printf(“%s\n”,x); x++; } }

2 Answers  


Sir... please give some important coding questions asked by product companies..

0 Answers  






C statement to copy a string without using loop and library function..

2 Answers   Persistent, TCS,


What is the hidden bug with the following statement? assert(val++ != 0);

1 Answers  


Write a routine to implement the polymarker function

0 Answers   TCS,


main() { char *p; p="%d\n"; p++; p++; printf(p-2,300); }

1 Answers  


void main() { int x,y=2,z; z=(z*=2)+(x=y=z); printf("%d",z); }

4 Answers  


Question: We would like to design and implement a programming solution to the reader-writer problem using semaphores in C language under UNIX. We assume that we have three readers and two writers processes that would run concurrently. A writer is to update (write) into one memory location (let’s say a variable of type integer named temp initialized to 0). In the other hand, a reader is to read the content of temp and display its content on the screen in a formatted output. One writer can access the shared data exclusively without the presence of other writer or any reader, whereas, a reader may access the shared memory for reading with the presence of other readers (but not writers).

1 Answers  


main() { void swap(); int x=10,y=8; swap(&x,&y); printf("x=%d y=%d",x,y); } void swap(int *a, int *b) { *a ^= *b, *b ^= *a, *a ^= *b; }

2 Answers  


Categories