stdio-dataTypes
title: "c-course - stdio-dataTypes.md"
- **fileName**: stdio-dataTypes
- **Created on**: 2024-06-05 15:20:52
phrase
Stdio.h
a stander library using for input and output
// for print varible
printf("for print a stirng: %s", name);
// for store formated text in varible
const char name[10] = "yossef";
char foo[50];
sprintf(nameVaribleForSaveData, "for print a stirng: %s", name);
// for saving a formated text into file
FILE *file = fopen("output.txt", "w");
fprintf(file, "Hello, you are 20 years old.\n" );
fclose(file);
vprintf: Used to print formatted output to the standard output, using a va_list for variable arguments.
// for take input from user and print it
char name[];
printf("enter the first name: );
scanf("%s", name);
printf("name is: %s", name);
**data types **
the main data types in any language is int float double and char and string but in c there's no
data type name string there char[] of strings and long long int
- and there is bool datatypes but you must include <stdbool.h> for using bool
int a = 4000; // positive integer data type
float b = 5.2324; // float data type
char c = 'Z'; // char data type
long d = 41657; // long positive integer data type
long e = -21556; // long -ve integer data type
int f = -185; // -ve integer data type
short g = 130; // short +ve integer data type
short h = -130; // short -ve integer data type
double i = 4.1234567890; // double float data type
float j = -3.55; // float data type
signed Data
dataType | Size |
---|---|
int | 4 bytes |
byte | 1 byte |
float | 4 bytes |
double | 8 bytes |
bool | 1 byte |
char[size] | size |
char | 1 byte |
long long int | 8 bytes |
unsigned Data
Data Type | Size |
---|---|
unsigned int | 4 bytes |
unsigned char | 1 byte |
unsigned float | - |
unsigned double | - |
unsigned bool | 1 byte |
unsigned char[size] | size |
unsigned char | 1 byte |
unsigned long long int | 8 bytes |
check for the formated string formated-string.md
check for the string.h string.h.md
** constant variable **
can make const by two ways in c
-
const int age = "20";
- Use const for constants that require type checking, memory allocation, and are used within a specific scope.
-
#define age 20;
- Use #define for simple, constant values that don't require a type or memory allocation, and when you need global scope or want to use them in preprocessor directives.
continue: formated-string.md
before: installation.md