administrator's blog

(LINKS) C, C++ Tutorials, FAQs, and Helpful Articles.

(LINKS) C, C++ Tutorials, FAQs, and Helpful Articles.

(FAQ) FREQUENTLY ASKED PROGRAMS IN C, C++

FREQUENTLY ASKED PROGRAMS(FAQs) IN C, C++

 1. Program to convert upper case to lower case or lower case to upper case .

 2. Program to count no. of characters,no. of blanks,no. of words & no. of lines in a multi line string

 3. Program  to correct rudimentary syntax errors.

 4Program to encrypt & decrypt a given string.

 5. Program for Drop Down in C

 6. Program for finding the prime numbers

 7. Program for finding the sum of digits of a five digit number

 8. Program for Prime Number Generation

 9. Program to calculate frequency of vowels in a string

 10.Program to calculate the sum of series

 11.Program to calculate the Typing Speed

 12.Program to copy its input to its output replacing string of one or more blanks by a single blank.

 13.Program to display all vowels in a i/p line of text

 14.Program to find the type of the triangle made by i/p values of its coordinates of its vertices

 15.Program to find wheather a given year is leap year or not.

 16.Program to Multiply Two Matrices

 17.Program to reverse the input string

 18.Program. to find & replace any desired character from the input text

 19.Prg. to sort any no. of numeral i/p in ascending or descending order

 20.Prg. to find the existence & frequency of an i/p substring in a main string

(Puzzles) Interesting C Programing Problems

Interesting C Programing Problems (Level- Intermediate to Advance)


The following C program segfaults of IA-64, but works fine on IA-32.
1  int main()
2  {
3      int* p;
4      p = (int*)malloc(sizeof(int));
5      *p = 10;
6      return 0;
7  }
Why does it happen so?
The expected output of the following C program is to print the elements in the array. But when actually run, it doesn't do so.
 1  #include<stdio.h>
 2
 3  #define TOTAL_ELEMENTS (sizeof(array) / sizeof(array[0]))
 4  int array[] = {23,34,12,17,204,99,16};
 5
 6  int main()
 7  {
 8      int d;
 9
10      for(d=-1;d <= (TOTAL_ELEMENTS-2);d++)
11          printf("%d\n",array[d+1]);
12
13      return 0;
14  }
Find out what's going wrong.
The following program doesn't "seem" to print "hello-out". (Try executing it)
 1  #include <stdio.h>
 2  #include <unistd.h>
 3  int main()
 4  {
 5          while(1)
 6          {
 7                  fprintf(stdout,"hello-out");
 8                  fprintf(stderr,"hello-err");
 9                  sleep(1);
10          }
11          return 0;
12  }
What could be the reason?
 1  #include <stdio.h>
 2  #define f(a,b) a##b
 3  #define g(a)   #a
 4  #define h(a) g(a)
 5
 6  int main()
 7  {
 8          printf("%s\n",h(f(1,2)));
 9          printf("%s\n",g(f(1,2)));
10          return 0;
11  }
Just by looking at the program one "might" expect the output to be, the same for both the printf statements. But on running the program you get it as:

(FREE BOOK) Free AJAX Book @ Sun Developer Network

(FREE BOOK) Free AJAX Book @ Sun Developer Network



http://sunevents.idealake.com/registration.jsp


join SDN now!


http://developers.sun.com/index.html

(QUESTIONS) ANSWER THIS:: C, C++ Questions

ANSWER THIS:: C,C++ Questions

1)Which is faster and why
for(i=0;i<1000;i++) or for(i=1000;i>=0;i--)

2)how can we include other than a .h using #include

3)which is faster and why

fun(typedef struct a X) or fun(typedef struct a *pX)

4)how can we print "HELLO WORLD" with out using semicolon

5) what is the purpose of volatile modeifier

6) how can we avoid multiple enteries of files included by #include

6)why is enum is better compared to #define constant

Syndicate content