Tuesday, July 12, 2011

POINTERS

0 comments
A pointer in C is the address of something. It is a rare case indeed when we care what the specific address itself is, but pointers are a quite common way to get at the contents of something. The unary operator ‘&’ is used to produce the address of an object, if it has one. Thus int a, b; b = &a; puts the address of a into b We can’t do much with it except print it or pass it to some other routine, because we haven’t given b the right kind of declaration. But if we declare that b is indeed a pointer to an integer, we’re in good shape: int a, *b, c; b = &a; c = *b; b contains ...
Continue reading →

CREATE NEGATIVE FROM PNG IMAGE

0 comments
HI,here we will discuss about how we can create a negative image from png image by using C program.The source code of C Program is given below.Just try it. SOURCE CODE /*CREATE NEGATIVE FROM PNG IMAGE*/ #include <stdio.h> #include <error.h> #include <gd.h> int main(int argc, char *argv[]) {  FILE *fp = {0};  gdImagePtr img;  char *iname = NULL;  char *oname = NULL;  int color, x, y, w, h;  int red, green, blue;  color = x = y = w = h = 0;  red = green = blue = 0;  if(argc != 3)   error(1, 0, "Usage: gdnegat input.png output.png");  else ...
Continue reading →