20130511

How to prepare C++/CPP/C for interview

Frequently asked C++ questions in interviews: 

  1. How to compare two strings using pointer without strcmp

  2. How to copy a string without using strcp with pointer

  3. How to find the length of a string without using library function strlen

  4. How to reverse a string using pointer or array in cpp without using strrev library function

  5. CPP program for concatenating two strings without using inbuilt library function strcat

  6. How to search a substring in C++/Cpp without using library function strstr

  7. How to use make file in CPP C+++ C

  8. How to implement msgq message queue in CPP C C++

  9. How to use callback function pointer in cpp/C/C++

  10. How to use malloc for 2d array dynamic memory allocation

  11. How to use new to allocate memory for 3d array in CPP C++

  12. How to learn stack and flow of function call and control in cpp

  13. How to learn recursive function call in cpp/C++/C

  14. How to distinguish between call by value, call by reference, call by address

  15. How to write cpp program for Circular Queue using Array

  16. How to write cpp program for Circular Queue using Linked List

  17. How to write cpp program for BST Binary Search Tree

  18. How to write cpp program to reverse a linked list

  19. How to write sorted linked list program in cpp with class

  20. How to use template in cpp

  21. Why to use explicit keyword in C++

  22. How to use new and delete in C++

  23. Getter and Setter Methods in C++

  24. C++ Program to Add Two Numbers using Class

  25. C++ Program for Fibonacci series

  26. Simple Program for malloc in C

  27. Is it necessary to accept an object by reference in copy constructor?

  28. Multiplication of two numbers using BITWISE operators

  29. New Features in ANSI C++ Standard

  30. Bitwise operation for division

  31. How to pass a object and return a object in C++/Cpp

  32. How to acces private member function in C++/CPP

  33. Why destructor should be virtual in C++ ?

  34. How to use tricky while loop in CPP,C++,C

  35. How to use for loop in C++ CPP C

  36. Program in C++ to learn virtual function

  37. How to use Virtual function C++

  38. Program to create a table in C
                                                                  Next Page


20130509

How to compare two strings using pointer without strcmp


/*C++/CPP/C program to compare two strings without using  library function strcmp*/
#include<stdio.h>
#include<string.h>
int strCmp(char *p1, char *p2);

int main()
{
char arr1[20];
printf("Enter a String:\n");
scanf("%s",&arr1);
char arr2[20];
printf("Enter a String:\n");
scanf("%s",&arr2);

printf("You entered:%s and %s\n",arr1,arr2);

20130505

How to copy a string without using strcp with pointer

/*How to copy a string without using library function strcpy.
How to use pointer/array to copy a string/sentence. C++/CPP/C program/code to copy a string/word/sentence without using inbuilt function strcpy.How copy a string without using library function strlen. cpp program to copy a string using pointer.cpp program to copy a string without using library function strcpy*/
#include<stdio.h>
#include<string.h>

void strCpy(char *p2,char *p1);

int main()
{
char arr1[20];
char arr2[20];
printf("Enter a String:\n");
scanf("%s",&arr1);

strCpy(arr2, arr1);

printf("You entered and copied:%s\n",arr2);

20130504

How to find the length of a string without using library function strlen


/*How to find length of a string without using library function strstr.
How to use pointer/array to find length of string sentence. C++/CPP/C program/code to find length a string/word/sentence without using inbuilt function strlen.How to find the length of a string without using library function strlen*/
#include<stdio.h>
#include<string.h>

int strLen(char *p);

int main()
{
char arr1[20];
printf("Enter a String:\n");
scanf("%s",&arr1);

printf("You entered:%s\n",arr1);
int n;
n=strLen(arr1);
printf("Strlen of entered string is:%d\n",n);