User Tools

Site Tools


Sidebar

Programming Reference/Librarys

Question & Answer

Q&A is closed







c:stdlib.h:sizeof

Table of Contents

sizeof

#include <stdlib.h>
 
    int sizeof(VALUE);

sizeof operator returns the number of bytes to be reserved for a variable or a data type.

C Sourcecode Example

#include <stdio.h> /* including standard library */
#include <stdlib.h>
//#include <windows.h> /* uncomment this for Windows */
 
 
int main(void){
 
printf("int:         %d bytes\n", sizeof(int) );
printf("Hello World: %d bytes\n", sizeof("Hello World") );
 
return 0;
}

Output

  Output:
  user@host:~$ ./sizeof 
  int:         4 bytes
  Hello World: 12 bytes
advertising
c/stdlib.h/sizeof.txt · Last modified: 2013/01/22 22:02 (external edit)

Impressum Datenschutz