Tuesday, 26 September 2017

how to generate colorful output in c language

To generate colorful output on console in c language we are going to use a predefined function of c language that is textcolor().

Now ,in this post we will learn how to use this textcolor funtion to generate colorful output on console.

declaration of textcolor -

void textcolor(int color);

here we have to send the integral value of the corresponding  color that we want to use .

Color Numerical Value
BLACK 0
BLUE 1
GREEN 2
CYAN 3
RED 4
MAGENTA 5
BROWN 6
LIGHTGRAY 7
DARKGRAY 8
LIGHTBLUE 9
LIGHTGREEN 10
LIGHTCYAN 11
LIGHTRED 12
LIGHTMAGENTA 13
YELLOW 14
WHITE 15

here are more colors than this. The colors available depend on the installed graphics drivers and current mode. Colors must be written in all Upper Case
because these colors are predefined macros.



                        note :we must use cpreintf function instead printf.

 #include<conio.h>  
 #include<stdio.h>  
 int main()  
 {  
         textcolor(RED);// the color is set to red  
         cprintf("I am Red");///the output will be in red color  
         textcolor(GREEN);// the color is set to green  
         cprintf("I am green");///the output will be in green color  
         textcolor(BLUE);// the color is set to blue  
         cprintf("I am blue");///the output will be in blue color  
         textcolor(CYAN);// the color is set to cyan  
         cprintf("I am Cyan");///the output will be in Cyan color  
         textcolor(YELLOW);// the color is set to yellow  
         cprintf("I am Yellow");///the output will be in yellow color  
        return 0;  
 }  

Friday, 1 September 2017

CONSTANT EXPRESSION REQUIRED-ERROR IN C PROGRAMMING

CONSTANT EXPRESSION REQUIRED-ERROR IN C PROGRAMMING 




The above program has error 'constant expression required' that means in between the [ ] constant yielding expression is needed or constant of type integer is needed.
While declaring an array the compiler must know how much memory will be reserved for how many elements of the array. So in C language at the time of declaration of an array we must provide a meaningful size of the array and the number of elements of any array can not be non- integral.
The size of the array must be integer because the number of elements can not be in fraction they can only be in integral numbers and cant be float or double.
               On the other context ,if we want to give the size of the array at the time of execution then we have to deal with a concept known as dynamic memory allocation and we need to use some predefined functions as calloc() ,malloc() and realloc().

WhatsApp will give Rs 1.8 crores to new Indian startups, Here is all you need to know

The "Startup India WhatsApp Grand Challenge" has been appraise growth in the entrepreneurial sector. Total prize money of Rs 1.8...