Skip to main content

Posts

Showing posts from April, 2023

Introduce character set and apply it

 . In computing, a character set is a collection of characters that can be used in a particular programming language or text encoding system. A character set defines the set of letters, digits, punctuation marks, and other symbols that can be used to represent text in a give context. One of the most common character sets used in computing is ASCII (American Standard Code for Information Interchange), which includes a set of 128 characters, including uppercase and lowercase letters, numbers, punctuation marks, and control characters. In C programming, character sets are important because they define the set of characters that can be used to write C code, as well as the set of characters that can be input and output by C programs. C users ASCII as its default character set, but it also supports extended character sets such as Unicode. Here's an example of how character sets can be used in C programming; # include   <stdio.h>   int   main ()   {  char  message[] =  "Hello,

Introduce C preprocessor and header files and use them

 . The C preprocessor is a part of the C compiler that processes source code before compilation. It's responsible for performing text replacements, file inclusion, and conditional compilation. One of the most common uses of the C preprocessor is to include header files. Header files contain function and variable declarations that are needed by your C program. They typically have a ".h" file extension and are included in your C code using the "#include" directive. For example, if you have a header file called "stdio.h" that contains declarations for standard input/output functions like "printf" and "scanf", you can include it in your C code like this:      # include   <stdio.h> This tells the C preprocessor to copy the contents of "stdio.h" into your C code before compilation. This way, your code can call the functions declared in "stdio.h" without having to define them itself. Header files can also define m