C Programming - Arrays - Discussion
Discussion Forum : Arrays - General Questions (Q.No. 3)
3.
In C, if you pass an array as an argument to a function, what actually gets passed?
Answer: Option
Explanation:
The statement 'C' is correct. When we pass an array as a funtion argument, the base address of the array will be passed.
Discussion:
31 comments Page 2 of 4.
Shikha said:
1 decade ago
Base address is the first element of the memory locations.
Diksha said:
1 decade ago
When we pass the array name of a 2-d array as an argument to a function and store the address in a integer pointer in the function, the compiler shows an error "10 C:\Users\DJ\Documents\devc\pointerarray.cpp cannot convert `int (*) [4]' to `int*' for argument `1' to `void display (int*, int, int) ' ".
Compiler- DEV C.
Compiler- DEV C.
Manisha said:
1 decade ago
Find out the value of array.
Rajab said:
1 decade ago
Write a program that reads values into an array from a file and sorts the data and writes it in a file.
Help me out with this.
Help me out with this.
Tanu said:
1 decade ago
Base address same as first address of array element?
Sayantani said:
1 decade ago
When we passing a hole array as argument like:
getArray(int formal[])
{
int i;
for(i=0;i<12;i++)
{
scanf("%d",&formal[i]);
}
return (formal)
}
main
{
int Array[12];
getArray(Array);
for(i=0;i<12;i++)
{
printf("%d\n",Array[i]);
}
getch();
}
--------------------------------------
In getarray(array); ... which technique we are using call by value or call by reference ?
getArray(int formal[])
{
int i;
for(i=0;i<12;i++)
{
scanf("%d",&formal[i]);
}
return (formal)
}
main
{
int Array[12];
getArray(Array);
for(i=0;i<12;i++)
{
printf("%d\n",Array[i]);
}
getch();
}
--------------------------------------
In getarray(array); ... which technique we are using call by value or call by reference ?
Vini said:
1 decade ago
What is meant by first element?
Promila said:
1 decade ago
Base address of the array and array passing by reference are same or different.
Ravneet said:
1 decade ago
@Poonam.
Base address is the address of list element of the array.
If we pass only name of the Array to a function, it basically means that The base address is passed.
Base address is the address of list element of the array.
If we pass only name of the Array to a function, it basically means that The base address is passed.
Praveena said:
1 decade ago
What is first element address?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers