Covert c program to assembly language program Compiler uses -S option to generate assembly language code for the given c source code. Below is the c source code(program.c). #include <stdio.h> int main() { int a, b, c; a = 20, b = 30; c = a + b; printf("Sum of two numbers is %d\n", c); return 0; } C source code can be converted to assembly code using the following command. jp@jp-VirtualBox:~/$ gcc -S program.c jp@jp-VirtualBox:~/$ ls program.c program.s Below is the assembly code for the above given c source code. .file "program.c" .section .rodata .LC0: ...
textcolor function is used to change the color of drawing text in c programs. Declaration :- void textcolor(int color); where color is an integer variable. For example 0 means BLACK color, 1 means BLUE, 2 means GREEN and soon. You can also use write appropriate color instead of integer. For example you can write textcolor(YELLOW); to change text color to YELLOW. But use colors in capital letters only. C programming code to change text color #include<stdio.h> #include<conio.h> main() { textcolor(RED); cprintf("C programming"); getch(); return 0; } C programming code for blinking text #include<stdio.h> #include<conio.h> main() { textcolor(MAGENTA+BLINK); cprintf("C programming"); getch(); return 0; } Note that we have used cprintf function instead of printf. This is because cprintf send formatted output to text window on screen and...
Comments
Post a Comment