SE250:lab-2:rbha033
I started off Task 1 with this code
#include <stdio.h>
int main(){
int x = 10;
double a = 10;
long b = 10;
char c;
float d=10;
int *ip=&x;
int *p;
printf("%d %d, %d %d %d %d %d \n", sizeof(ip), sizeof(p), sizeof(x), sizeof(a), sizeof(b), sizeof(c), sizeof(d));
return 0;
}
It ran to give me the result:
gcc -o task1 task1.c && ./task1.exe 4 4, 4 8 4 1 4 Compilation finished at Tue Mar 11 11:10:07
Question: Are all pointers the same size?
Answer: YES! They only store an address and all the addresses are the same size.
Question: What other data types are the same size?
Answer: int,long and float. Rbha033 11:26, 11 March 2008 (NZDT)