├── C-programing ├── Questions │ ├── gstCalculator │ │ └── index.c │ ├── isindian │ │ ├── a.exe │ │ └── index.c │ ├── printTable │ │ ├── a.exe │ │ └── index.c │ ├── cubeOfNumber │ │ ├── a.exe │ │ └── index.c │ ├── squarePattern │ │ ├── a.exe │ │ └── index.c │ ├── AverageOfThreeNum │ │ ├── a.exe │ │ └── index.c │ ├── marriageValidation │ │ ├── a.exe │ │ └── index.c │ ├── passwordValidator │ │ ├── a.exe │ │ └── index.c │ ├── EvenNumbervalidation │ │ ├── a.exe │ │ └── index.c │ └── perimeterOfRectangle │ │ ├── a.exe │ │ └── index.c ├── ProgramStructure │ ├── index.c │ ├── image.png │ ├── compilation.png │ └── Notes.md ├── FirstCode │ ├── a.exe │ ├── mingGw.png │ ├── Hello.c │ └── Notes.md ├── VariablesAndDataTypes │ ├── a.exe │ ├── variables.c │ ├── index.c │ └── Notes.md └── IntoductionOfComputers │ ├── BasicComputerOrganization.png │ └── notes.md ├── a.exe ├── README.md └── .vscode └── tasks.json /C-programing/Questions/gstCalculator/index.c: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /a.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepumandal/Amity-University-BCA-sem-1/HEAD/a.exe -------------------------------------------------------------------------------- /C-programing/ProgramStructure/index.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | return 0; 6 | } -------------------------------------------------------------------------------- /C-programing/FirstCode/a.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepumandal/Amity-University-BCA-sem-1/HEAD/C-programing/FirstCode/a.exe -------------------------------------------------------------------------------- /C-programing/FirstCode/mingGw.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepumandal/Amity-University-BCA-sem-1/HEAD/C-programing/FirstCode/mingGw.png -------------------------------------------------------------------------------- /C-programing/Questions/isindian/a.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepumandal/Amity-University-BCA-sem-1/HEAD/C-programing/Questions/isindian/a.exe -------------------------------------------------------------------------------- /C-programing/ProgramStructure/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepumandal/Amity-University-BCA-sem-1/HEAD/C-programing/ProgramStructure/image.png -------------------------------------------------------------------------------- /C-programing/Questions/printTable/a.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepumandal/Amity-University-BCA-sem-1/HEAD/C-programing/Questions/printTable/a.exe -------------------------------------------------------------------------------- /C-programing/Questions/cubeOfNumber/a.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepumandal/Amity-University-BCA-sem-1/HEAD/C-programing/Questions/cubeOfNumber/a.exe -------------------------------------------------------------------------------- /C-programing/Questions/squarePattern/a.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepumandal/Amity-University-BCA-sem-1/HEAD/C-programing/Questions/squarePattern/a.exe -------------------------------------------------------------------------------- /C-programing/VariablesAndDataTypes/a.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepumandal/Amity-University-BCA-sem-1/HEAD/C-programing/VariablesAndDataTypes/a.exe -------------------------------------------------------------------------------- /C-programing/FirstCode/Hello.c: -------------------------------------------------------------------------------- 1 | #include // <-- preprocessor directives 2 | 3 | int main() 4 | { 5 | printf("hello world\n"); 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /C-programing/ProgramStructure/compilation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepumandal/Amity-University-BCA-sem-1/HEAD/C-programing/ProgramStructure/compilation.png -------------------------------------------------------------------------------- /C-programing/Questions/AverageOfThreeNum/a.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepumandal/Amity-University-BCA-sem-1/HEAD/C-programing/Questions/AverageOfThreeNum/a.exe -------------------------------------------------------------------------------- /C-programing/Questions/marriageValidation/a.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepumandal/Amity-University-BCA-sem-1/HEAD/C-programing/Questions/marriageValidation/a.exe -------------------------------------------------------------------------------- /C-programing/Questions/passwordValidator/a.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepumandal/Amity-University-BCA-sem-1/HEAD/C-programing/Questions/passwordValidator/a.exe -------------------------------------------------------------------------------- /C-programing/Questions/EvenNumbervalidation/a.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepumandal/Amity-University-BCA-sem-1/HEAD/C-programing/Questions/EvenNumbervalidation/a.exe -------------------------------------------------------------------------------- /C-programing/Questions/perimeterOfRectangle/a.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepumandal/Amity-University-BCA-sem-1/HEAD/C-programing/Questions/perimeterOfRectangle/a.exe -------------------------------------------------------------------------------- /C-programing/IntoductionOfComputers/BasicComputerOrganization.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepumandal/Amity-University-BCA-sem-1/HEAD/C-programing/IntoductionOfComputers/BasicComputerOrganization.png -------------------------------------------------------------------------------- /C-programing/Questions/cubeOfNumber/index.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | 6 | int i; 7 | printf("Hello pls give me a number \n"); 8 | scanf("%d", &i); 9 | printf("cube is \n%d", i * i * i); 10 | 11 | return 0; 12 | } -------------------------------------------------------------------------------- /C-programing/Questions/EvenNumbervalidation/index.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int num; 6 | printf("Enter your Even Number\n"); 7 | scanf("%d", &num); 8 | printf(num % 2 == 0 ? "Even number" : "Not an Even number"); 9 | return 0; 10 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Amity-University-BCA-sem-1 2 | 3 | ## All folders have there indivisual Notes.md where set of instructions were written. 4 | 5 | ### [./C-programing/IntoductionOfComputers/notes.md](Introduction of cumpueter) 6 | ### [](input devices and memeory) 7 | ### []variables and datatypes 8 | ### program structure 9 | ### 10 | ### 11 | ### 12 | -------------------------------------------------------------------------------- /C-programing/Questions/perimeterOfRectangle/index.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | 6 | float width, height; 7 | printf("Enter your width\n"); 8 | scanf("%f", &width); 9 | printf("Enter your height\n"); 10 | scanf("%f", &height); 11 | 12 | printf("The perimeter of the given input is %f", 2 * (width + height)); 13 | return 0; 14 | } -------------------------------------------------------------------------------- /C-programing/Questions/passwordValidator/index.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() 5 | { 6 | 7 | char password[] = "password"; 8 | 9 | char input_password[20]; 10 | 11 | printf("Enter your password\n"); 12 | scanf("%s", &input_password); 13 | 14 | printf(strcmp(password, input_password) == 0 ? "OK\n" : "ERROR\n"); 15 | 16 | return 0; 17 | } -------------------------------------------------------------------------------- /C-programing/Questions/AverageOfThreeNum/index.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | 6 | int first, second, third; 7 | printf("Enter first Number\n"); 8 | scanf("%d", &first); 9 | printf("Enter second Number\n"); 10 | scanf("%d", &second); 11 | printf("Enter third Number\n"); 12 | scanf("%d", &third); 13 | 14 | printf("Avg : %d", (first + second + third) / 3); 15 | return 0; 16 | } -------------------------------------------------------------------------------- /C-programing/VariablesAndDataTypes/variables.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | 6 | // float input; 7 | float age; 8 | printf("Enter your Age\n"); 9 | scanf("%f", &age); 10 | 11 | printf("you age is %f\n\n", age); 12 | 13 | // character input 14 | char star; 15 | printf("Enter your Star\n"); 16 | scanf(" %c", &star); // Notice the space before %c to consume any preceding whitespace 17 | printf("you star is %c", star); 18 | return 0; 19 | } -------------------------------------------------------------------------------- /C-programing/Questions/squarePattern/index.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() 5 | { 6 | char star[] = "*"; 7 | int n; 8 | printf("enter value of n\n"); 9 | scanf("%d", &n); 10 | 11 | for (int i = 0; i < n; i++) 12 | { 13 | char str[n * 2]; 14 | strcpy(str, ""); // Initialize the string 15 | 16 | for (int j = 0; j < n; j++) 17 | { 18 | strcat(str, star); 19 | } 20 | printf("%s\n", str); 21 | } 22 | 23 | return 0; 24 | } -------------------------------------------------------------------------------- /C-programing/Questions/isindian/index.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void indian(){ 5 | printf("indian \n"); 6 | } 7 | void nonindian(){ 8 | printf("foreigners \n"); 9 | } 10 | 11 | 12 | int main() 13 | { 14 | int token = 5; 15 | char countary[20]; 16 | do{ 17 | printf("Enter Your country name :"); 18 | scanf(" %s", &countary); 19 | 20 | if(strcmp(countary, "india")== 0 || strcmp(countary, "India") == 0){ 21 | indian(); 22 | }else { 23 | nonindian(); 24 | } 25 | }while(token>=0); 26 | 27 | 28 | return 0; 29 | } -------------------------------------------------------------------------------- /C-programing/Questions/printTable/index.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void printTable(int x) 5 | { 6 | for (int i = 1; i <= 10; i++) 7 | { 8 | printf("%d * %d : %d\n", x, i, x * i); 9 | } 10 | } 11 | 12 | int main() 13 | { 14 | 15 | int isNew = 0; 16 | 17 | do 18 | { 19 | long int n; 20 | printf(!isNew ? 21 | "Enter Your first number\n" : 22 | "Enter number\n"); 23 | scanf("%d", &n); 24 | if (isNew == 0) 25 | { 26 | isNew = 1; 27 | } 28 | printTable(n); 29 | } while (1); 30 | 31 | return 0; 32 | } -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "tasks": [ 3 | { 4 | "type": "cppbuild", 5 | "label": "C/C++: gcc.exe build active file", 6 | "command": "C:\\MinGW\\bin\\gcc.exe", 7 | "args": [ 8 | "-fdiagnostics-color=always", 9 | "-g", 10 | "${file}", 11 | "-o", 12 | "${fileDirname}\\${fileBasenameNoExtension}.exe" 13 | ], 14 | "options": { 15 | "cwd": "${fileDirname}" 16 | }, 17 | "problemMatcher": [ 18 | "$gcc" 19 | ], 20 | "group": { 21 | "kind": "build", 22 | "isDefault": true 23 | }, 24 | "detail": "Task generated by Debugger." 25 | } 26 | ], 27 | "version": "2.0.0" 28 | } -------------------------------------------------------------------------------- /C-programing/Questions/marriageValidation/index.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | 6 | int age; 7 | char gender; 8 | 9 | printf("Gender: \n for male type m for female type f\n"); 10 | scanf(" %c", &gender); 11 | printf("Enter your age\n"); 12 | // scanf("age : %d", &age); 13 | scanf("%d", &age); 14 | 15 | if (gender == 'F') 16 | { 17 | if (age > 18) 18 | { 19 | printf("You are allowed to marriage\n"); 20 | } 21 | else 22 | { 23 | printf("wait for: %d\n", 18 - age); 24 | } 25 | } 26 | else 27 | { 28 | if (age > 21) 29 | { 30 | printf("You are allowed to marriage\n"); 31 | } 32 | else 33 | { 34 | printf("wait for: %d\n", 18 - age); 35 | } 36 | } 37 | 38 | return 0; 39 | } -------------------------------------------------------------------------------- /C-programing/VariablesAndDataTypes/index.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | 6 | // int input; 7 | // scanf("this is my %d", input); 8 | // printf("%d\n",input); 9 | // int number = 24.5; 10 | 11 | int input; 12 | printf("Enter an integer: "); 13 | scanf("%d", &input); // Use %d to read an integer and use & to get the memory address of 'input' 14 | 15 | printf("Input: %d\n", input); // Print the entered integer 16 | 17 | float number = 24.5; // Use float data type to store a floating-point value 18 | printf("Number: %f\n", number); 19 | 20 | printf("\n"); 21 | printf("\n"); 22 | printf("\n"); 23 | printf("\n"); 24 | /* 25 | - int is a datatype which store only whole numbers 26 | - even if you store number of decimal digits it only considers 27 | whole value as input number- 28 | outpur : 24 29 | */ 30 | float number1 = 24; 31 | /* 32 | - float is a datatype which store decimal digits if we provides 33 | whole number then the output will automatically be converted into deciamal 34 | output : 24.000000 35 | */ 36 | 37 | char starboy = '*'; 38 | /* 39 | char is used for storing string character 40 | note : always put it into '' single quotes 41 | also this only hold single character like A and B etc. 42 | */ 43 | /* 44 | 45 | to write entire sentence you need to use "", double quote 46 | and [] after variable like this 47 | */ 48 | 49 | char sentence[] = "hello this is my name"; 50 | printf("star is %c\n", starboy); 51 | printf("star is %s\n", sentence); 52 | printf("Number is %d\n", number); 53 | printf("Number is %f\n", number1); 54 | 55 | return 0; 56 | } -------------------------------------------------------------------------------- /C-programing/FirstCode/Notes.md: -------------------------------------------------------------------------------- 1 | # how to install and run C. 2 | C is a versatile and efficient programming language used for system software, applications, and embedded systems. Known for its flexibility and speed, C allows direct access to hardware and offers a rich set of features for low-level programming while being widely used across various domains due to its portability and powerful capabilities. 3 | ### Steps to Install: 4 | 5 | 1. **Download MinGW:** Search for "MinGW for Windows" or visit [MinGW Download](https://sourceforge.net/projects/mingw/) to download the installer. ![image](./mingGw.png) 6 | 7 | 2. **Run MinGW Installer:** Once downloaded, open the installer and follow the instructions. Choose the necessary components like the C compiler (`gcc`) during installation. 8 | 9 | 3. **Complete Installation:** Follow the prompts to complete the installation process. 10 | 11 | 4. **Locate MinGW Folder:** Find the MinGW installation folder, usually in `C:\MinGW\bin`. 12 | 13 | 5. **Add MinGW to System Path:** 14 | - Open System Properties. 15 | - Go to the "Environment Variables" section. 16 | - Under "Path", add a new entry with the MinGW bin path (e.g., `C:\MinGW\bin`). 17 | 18 | 6. **Test:** run `gcc -v`, if you got output some thing like this means **yureka**. 19 | 20 | ``` 21 | Using built-in specs. 22 | COLLECT_GCC=C:\MinGW\bin\gcc.exe 23 | COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/6.3.0/lto-wrapper.exe 24 | Target: mingw32 25 | Configured with: ../src/gcc-6.3.0/configure --build=x86_64-pc-linux-gnu --host=mingw32 --target=mingw32 --with-gmp=/mingw --with-mpfr --with-mpc=/mingw --with-isl=/mingw --prefix=/mingw --disable-win32-registry --with-arch=i586 --with-tune=generic --enable-languages=c,c++,objc,obj-c++,fortran,ada --with-pkgversion='MinGW.org GCC-6.3.0-1' --enable-static --enable-shared --enable-threads --with-dwarf2 --disable-sjlj-exceptions --enable-version-specific-runtime-libs --with-libiconv-prefix=/mingw --with-libintl-prefix=/mingw --enable-libstdcxx-debug --enable-libgomp --disable-libvtv --enable-nls 26 | Thread model: win32 27 | gcc version 6.3.0 (MinGW.org GCC-6.3.0-1) 28 | ``` 29 | 30 | ### Ready to Code: 31 | 32 | Now, you're ready to write and run C programs on your Windows system using any text editor like Notepad, Visual Studio Code, or Dev-C++. 33 | 34 | 35 | 1. **Create a C File:** Start by creating a file with any name and the `.c` extension. For example: 36 | ``` 37 | Helloworld.c 38 | ``` 39 | 40 | 2. **Add Code:** Put this sample code in the file: 41 | ```c 42 | #include 43 | 44 | int main() { 45 | printf("Hello from C"); 46 | return 0; 47 | } 48 | ``` 49 | 50 | 3. **Run in Terminal:** 51 | - **For Windows:** 52 | Open the terminal in the same directory as the filename. 53 | Execute: 54 | ```bash 55 | gcc filename.c 56 | ./a.exe 57 | ``` 58 | - **For Other Operating Systems:** 59 | Open the terminal in the same directory as the filename. 60 | Execute: 61 | ```bash 62 | gcc filename.c 63 | ./a.out 64 | ``` 65 | **This will display the output in the terminal. 👍** 66 | -------------------------------------------------------------------------------- /C-programing/IntoductionOfComputers/notes.md: -------------------------------------------------------------------------------- 1 | # Introduction of computers 2 | 3 | ## Computer 4 | 5 | It comes from the word "compute," which means to calculate. It is a device that operates on data. 6 | 7 | ### Basic Functions 8 | 9 | It performs the following five basic operations for converting raw input data into useful information and presenting it to the user: 10 | 11 | - **Inputting:** Process of entering data and instructions into a computer system. 12 | 13 | - **Storing:** Saving data and instructions to make them readily available for initial or additional processing as and when required. 14 | 15 | - **Processing:** Performing arithmetic operations (add, subtract, etc.) or logical operations (comparisons like equal to, less than, etc.) on data to convert them into useful information. 16 | 17 | - **Outputting:** Process of producing useful information or results for a user, such as printed reports or visual displays. 18 | 19 | - **Controlling:** It is like the brain—it manages and directs the activities of the other parts of the computer. The control unit oversees the flow of data and instructions within the CPU (Central Processing Unit) and coordinates the actions of the entire computer system. The control unit interprets instructions from the computer's memory, decodes them, and then executes or carries out those instructions by directing the other parts of the computer to perform specific tasks. 20 | 21 | ![Basic Computer Organization](./BasicComputerOrganization.png) 22 | 23 | ## Central processing unit (CPU ) 24 | 25 | it consists of the fowwlowing features 26 | 27 | - cpu is considered as the brain of the computer. 28 | - cpu performs all types of data processing operations. 29 | - it stores data, intermediate results and instructions {program} 30 | - it controls the operations of all parts of the computer. 31 | 32 | ## Input Unit 33 | 34 | - it accepts (or readds) instructions and data from outside world. 35 | - it converts these instructions and data in computer acceptable form. 36 | - it supplies the converteed instructions and data to comput er system for futher processing. 37 | 38 | ## Output Unit 39 | 40 | - it accepts the results produced by the computer,which are in coded form and hence, 41 | we cannot easily understand them. 42 | 43 | - it converts these coded results to human acceptable (readable) form. 44 | 45 | ### it holds (store): 46 | 47 | - Data and instruction required for processing ( recieved from input devices.) 48 | intermediate results of processing. 49 | results for output, before they are released to an output device. 50 | 51 | ### Types: 52 | 53 | Primary Storage: Also known as main memory, is used tohold pieces of programs instructions and data, intermediate results of processing and recently produced results of those jobs on which computer is currently working. it can hold information only while computer system is on. 54 | Secondary Storage: describtions 55 | 56 | ## ALU (arithmetic logic unit) 57 | this unit conststs of two sebsectiosn namely, 58 | ### Airthemetic section 59 | - Function of arithmetic section is to perform arithmetic operationslike adddition, subtract, multiplication adn deivision all complex operation are done by making reperitive use of the above operations. 60 | 61 | ### logic section 62 | function of logic sections is to perform logic operations such as comparing selecting, matching and merging of data. 63 | 64 | ## secondary storage : 65 | from chatgpt 66 | 67 | 68 | ## control Unit: 69 | from chatgpt 70 | 71 | Functions of the control unit 72 | -------------------------------------------------------------------------------- /C-programing/VariablesAndDataTypes/Notes.md: -------------------------------------------------------------------------------- 1 | # Variables and DataTypes 2 | 3 | **Variable** is like a box where you can keep information. It's a name given to a specific spot in the computer's memory. This name helps the computer remember and work with the data stored inside that spot. 4 | 5 | ## Rules for Declaring Variables 6 | 7 | 1. **Variables are Case-Sensitive:** Characters from 'a' to 'z' and 'A' to 'Z' are considered different. They must be used precisely as declared in the program. 8 | 9 | 2. **Naming Convention:** 10 | - The first character should be from `a-z`, `A-Z`, or `_`. 11 | - All characters that aren't special characters are allowed in the middle, except `_`. 12 | - **For example:** 13 | ```c 14 | int index = 0; // Valid 15 | int _index = 0; // Valid 16 | int 1index = 1; // Invalid 17 | int &index = 1; // Invalid 18 | int index_ = 0; // Valid 19 | int ind3ex = 0; // Valid 20 | ``` 21 | - Hyphens `-` and empty spaces `""` are not allowed as the first character. 22 | - `_` (underscore) is the only special character permitted for variable names. 23 | 24 | # Data Types 25 | 26 | | Data Type | Size (in bytes) | 27 | | --------------------------------- | --------------- | 28 | | `char or signed char` | 1 | 29 | | `unsigned char` | 1 | 30 | | `int or signed int` | 1 | 31 | | `unsigned int` | 2 | 32 | | `short int or unsigned short int` | 2 | 33 | | `signed short int` | 2 | 34 | | `long int or signed long int` | 4 | 35 | | `unsigned long int` | 4 | 36 | | `float` | 4 | 37 | | `double` | 8 | 38 | | `long double` | 10 | 39 | 40 | - there is no boolean or string types in c as it is one of oldest programming language. 41 | - Also there is slight difference in class and object in c. 42 | 43 | ### Most Used DataTypes 44 | 45 | - **int:** 46 | 47 | - It primally used to store whole number, however we can give the value like `3.1400` but it will store only `3` other will get ignored. 48 | - Range (`-2,147,483,648` to `2,147,483,647`), however on this range of number can be stored using int. 49 | - _example_ 50 | 51 | ``` 52 | int whole = 0; 53 | 54 | int input; 55 | scanf("this is my %d", &input) 56 | prinf(input) 57 | ``` 58 | 59 | - here int input; in variable declarations; 60 | - scanf() is inbuild function provided by c, used to take input's from user end. 61 | - %d under "" is telling the input will be an integer; 62 | and `&input` here & is telling to store input value to &input location 63 | 64 | - **float:** 65 | 66 | - it is used for storing decimal values like `3.14`. 67 | _for example_ 68 | 69 | ``` 70 | float pi = 3.14; 71 | float age; 72 | printf("Enter your Age\n"); 73 | scanf("%f", &age); 74 | printf("you age is %f", age); 75 | return 0; 76 | ``` 77 | 78 | - **char:** 79 | - this variable store's every character under ''. 80 | - `''` tells that the value be stored is only single character only. 81 | _for example_ 82 | ``` 83 | // character input 84 | char star; 85 | printf("Enter your Star\n"); 86 | scanf(" %c", &star); // Notice the space before %c to consume any preceding whitespace 87 | printf("you star is %c", star); 88 | ``` 89 | -------------------------------------------------------------------------------- /C-programing/ProgramStructure/Notes.md: -------------------------------------------------------------------------------- 1 | # Program Structure 2 | 3 | Here A brief description of program Structure 4 | 5 | ``` 6 | #include 7 | 8 | int main(){ 9 | 10 | return 0; 11 | } 12 | ``` 13 | 14 | - **preprocessor directive:** The line `#include` in C is called a preprocessor directive. It tells the compiler to include the standard input and output library (stdio.h) in the program, allowing the use of functions like `printf()` and `scanf()` for input and output operations. 15 | 16 | - **int main() { }:** This is the main function of the program. In C, every program must have a `main()` function; it's the entry point of execution. 17 | 18 | - _`int` before `main()` specifies that the function returns an integer value._ 19 | 20 | - The curly braces `{ }` indicate the beginning and end of the function body. Code inside these braces is what the main() function will execute. 21 | 22 | - The `return 0;` statement inside `main()` signifies the end of the `main()` function. In this context, `return 0;` indicates that the program has executed successfully. In C, returning `0` from `main()` typically implies successful completion of the program execution. 23 | 24 | # constants 25 | 26 | In C programming, constants are fixed values that do not change during program execution. There are various types of constants: 27 | 28 | 1. **integer constants:** 29 | These are whole numbers without any fractional or decimal part. They can be represented in decimal, octal (using a leading 0), or hexadecimal (using a leading 0x) format. For example: 30 | 31 | - Decimal: 123 32 | - Octal: 0123 33 | - Hexadecimal: 0xAB 34 | 35 | 2. **real constants:** 36 | These are numbers with a fractional part. They include a decimal point. For example: 37 | 38 | - 3.14 39 | - 2.0e-5 40 | 41 | 3. **character constants:** 42 | These represent single characters enclosed within single quotes. For instance: 43 | - 'A' 44 | - '5' 45 | - '\n' (newline character) 46 | 47 | # Reserver keywords 48 | 49 | These are the english words that are reserved by c. you cannot use them as variable name there are total `32` reserver keywords 50 | 51 | | Column 1 | Column 2 | Column 3 | Column 4 | Column 5 | 52 | | -------- | -------- | -------- | -------- | -------- | 53 | | auto | break | case | char | const | 54 | | continue | default | do | double | else | 55 | | enum | extern | float | for | goto | 56 | | if | int | long | register | return | 57 | | short | signed | sizeof | static | struct | 58 | | switch | typedef | union | unsigned | void | 59 | | volatile | while | | | | 60 | 61 | # comments 62 | 63 | 1. **single Line** : `//` 64 | 65 | 2. **multi Line** : `/**/` 66 | 67 | # format specifires 68 | 69 | In C programming, format specifiers are used with input and output functions like printf() and scanf() to specify the type of data being used. Here are some common format specifiers: 70 | 71 | | Format Specifier | Description | 72 | | ---------------- | ------------------------------------------------------------------------------------- | 73 | | %d | Represents an integer value. | 74 | | %f | Represents a floating-point value (decimal notation). | 75 | | %c | Represents a single character. | 76 | | %s | Represents a string of characters. | 77 | | %p | Represents a pointer address. | 78 | | %x or %X | Represents an unsigned hexadecimal integer (lowercase/uppercase). | 79 | | %o | Represents an unsigned octal integer. | 80 | | %u | Represents an unsigned decimal integer. | 81 | | %e or %E | Represents a floating-point number in scientific notation (lowercase/uppercase). | 82 | | %g or %G | Represents a floating-point number in either %f or %e notation (lowercase/uppercase). | 83 | | %% | Represents a literal percent sign (%). | 84 | 85 | # compilation 86 | 87 | A program that converts c code to binary format fo that computer hardware can understand 88 | 89 | ![image](./compilation.png) 90 | --------------------------------------------------------------------------------