KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Possible Duplicate: Sizeof an array in the C programming language? Why does a C-Array have a wrong sizeof() value when it's passed to a function? See the below code and suggest me that what is the difference of " sizeof " keyword when I used like this: #include<stdio.h> #include<conio.h> void show(int ar[]); void main() { int arr[]={1,2,3,4,5}; clrscr(); printf("Length: %d\n",sizeof(arr)); printf("Length: %d\n",sizeof(arr)/sizeof(int)); show(arr); getch(); } void show(int ar[]) { printf("Length: %d", sizeof(ar)); printf("Length: %d", sizeof(ar)/sizeof(int)); } But the output is like this: Output is: Length: 10 Length: 5 Length: 2 Length: 1 why I am getting like this; If I want to take the entire data from one array to another array the how can I do? Suggest me If anyone knows.
Tags (comma-separated)
Save Edits
Cancel