AliBahar
Member level 2
- Joined
- Feb 4, 2015
- Messages
- 42
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 6
- Activity points
- 337
Hi
when I compiled this code in visual studio the num1 equals with 4.
and if I changed the size of data array the previous value is appeared and it is not changed.
when I compiled this code in visual studio the num1 equals with 4.
and if I changed the size of data array the previous value is appeared and it is not changed.
Code:
#include "stdio.h"
char data[]={0x11, 0x12, 0x14, 0x12};
char sizeCount(char *ptr){
static char num;
num=sizeof(ptr);
return num;
}
int main(void){
char num1;
num1=sizeCount(data);
printf("%d", num1);
getchar();
return 0;
}