Question: Objectives Learn how to use the sizeof ( ) operator for various basic C data types. More practice with a makefile. Write a C program

Objectives
Learn how to use the sizeof() operator for various basic C data types.
More practice with a makefile.
Write a C program (called sizeof.c) that uses the sizeof() operator to print the number of bytes and number of bits the required for basic C data types on the ada server. Write a makefile to compile the C file. Show the number of bytes and bits required for the following C data types:
char
short
int
long
float
double
long double
void *
The output from your program should look like this:
rchaney # ./sizeof
Size of basic C data types
sizeof(char)1 byte 8 bits
sizeof(short)2 bytes 16 bits
sizeof(int)4 bytes 32 bits
sizeof(long)8 bytes 64 bits
sizeof(float)4 bytes 32 bits
sizeof(double)8 bytes 64 bits
sizeof(long double)16 bytes 128 bits
sizeof(void *)8 bytes 64 bits
The CFLAGS and LDFLAGS variables in the makefile should use these:
CFLAGS =-g3-Wall -Werror -std=c11-pedantic
LDFLAGS =-lm -no-pie

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!