Short Notes

Since developing a love for STEM, I have always tried to include all the stuffs that I discovered my own and those which has seemed to me very important and also for learning and storming brain. In this pursuit I've added several contents here including those from YouTube, Google, ChatGPT, Gemini, Websites, some books and from the learning stages for my self growth and development. I have tried to include all the contents that I have thought and expressed as well as organized on my own approach up to this day.



Note 1-

If you store an integer variable inside an integer type variable and then print it by changing its format specifier from %d to %c, you will get character, on the contrary if you store a character variable inside an character type variable and then print by changing its format specifier from %c to %d, you will get integer value. Do you know why it happened? It has happened because of the ASCII numbers.

For the first case-

Code-


#include <stdio.h>

int main(void){
    char ch = 'a';
    printf("%d", ch); /*97*/
    return 0;
}
        

For the second case-

Code-


#include <stdio.h>

int main(void){
    int ch = 97;
    printf("%c", ch); /*a*/
    return 0;
}