How do you write a C program which can calculate lines of code but not counting comments?
working code ************************#includemain(){ FILE *f; char ch;int c=0; f=fopen("reddy", "r"); ch=fgetc(f); while(!feof(f)) { switch(ch)...
main(){FILE f=open a file in readmodechar ch;int c=0;ch=fgetc(f);while(!feof(f)){switch(ch){case "/" : if (fgetc(f)=="*") while (fgetc(f)!="*" and fgetc(f)!="/");break; ca...
How to remove duplicate elements from an array
//simple BST program with little change#include#includestruct btree{Â Â Â Â Â Â Â int data;Â Â Â Â Â Â Â struct btree *lnode;Â Â Â Â Â Â Â struct btree *rnode;};typedef struct btree *tree_pntr;type...
time complexity will be <O(nlogn)
What is the difference between constant to pointer and pointer to constant?
pointer to constant: If a pointer is pointing to constant it is called as pointer to constant.In this case we cannot change the content of constant.eg : const int n=5; int *p=&n;in thi...
Constant pointer:If a pointer is pointing to a constant whose value(constant)can't be changed.Eg:Consider the declaration int a[10];here a is a pointer to the base address of the array say 1000.When w...
Answer to Question 4.Here I am giving the full program which should run without any warning and error in Turbo C++ 3.0<-------------------------------------------------------------------------...
#include <stdio.h>#include <math.h>#include <stdlib.h>int main(void){ int x,y,ref; int numbits=0; printf("Input the desired...
C is a structural or highlevel or middle level language which one is correct answer
c is a high level procedure oriented structured programming language
C is middle level language because it perform like low level of operation etc and also perform high level operations so its middle . and C is structural lang
What would be the output of the following program? Main() { int i=4; switch(i) { ...
A) a) a mouse is an elephant built by the japanese b) b) breeding rabbits is a hare raising experience c) c) a mouse is an elephant built by the japanese breeding rabbits is a hare raising experienced) d) none of the above
Ans should be A+B because there is no break; at the end of default section which will lead the program flow into the first case till the break;
The answer is C
A subquery within a subquery
A query within a subquery
A Correlated Subquery which executes with value returned by the child Query. Unlike subquery it executes per result from child query.
Ex: removing duplicate rows from a table
Subquery executes once for the entire child query's result
What is the difference between encapsulation and datahiding.Explain with example
encapsulation is the wrapping up of data members and data functions into a single unit like classes. here we can control the visibility of data with the help of access specifiers i.e. public,private and protected.
in data hiding data is totally private we cannot access the data.
encapsulation is the concept of the datamember. Data Hiding is the Access Specifier.
what are the advantages of using pointers in a program?
The advantages of using pointers are: 1: you can work with the address of the variable2: you can reference the variables in more different easiest ways....   e.g int a[10],*b;         Â...
thanks your's answer is wellplease send me examples of pointers like functions using pointers,structures using pointers etc
Difference between realloc() and free()?
The free subroutine frees a block of memory previously allocated by the malloc subroutine. Undefined results occur if the pointer parameter is not a valid pointer. If the pointer parameter is a null value, no action will occur. The realloc subroutine changes the size of the block of memory pointed to...
free() - releases the memory of the pointer passed as parameter, to the OS/application consumption. Using the pointer after free() will result in undefinded resultsrealloc() - used to resize the memor...
Mitra,as you mentioned that realloc will delete the existing memory and allocate the new memory . I tried it on solaris and following is found :1. If the new size allocated is less than the existing m...
What is an argument ? Differentiate between formal arguments and actual arguments?
An argument is an entity used to pass the data from calling funtion to the called funtion. Formal arguments are the arguments available in the funtion definition.They are preceded by their own data types.Actual arguments are available in the function call.
FORMAL ARGUMENT :-The argument declared in function header is called formal argument......
ACTUAL ARGUMENT:- The argument passed to function while the function is called actual parameter.........
The actual arguments are the arguments with which the function can be called. The formal arguments are the arguments with which the function can be defined.Simply, function call contains actual ...
What are the characteristics of arrays in c?
1) an array holds elements that have the same data type 2) array elements are stored in subsequent memory locations3) two-dimentional array elements are stored row by row in subsequent memory locations.4) array name represents the address of the starting...
Array: can be defined as a group of elements stored in contigous memory locations and all elements hold the data of same data type. All elements share a common name - array name.Example: int array[10]...
must be homogenious i.e same data type
Both the merge sort and the radix sort are good sorting algorithms to use for linked lists.
For this no need to write sepate function. We can arrage the elements in order by using some comaprisons in creation of list.
What is the quickest searching method to use?
A binary search, such as bsearch() performs, is much faster than a linear search. A hashing algorithm can provide even faster searching. One particularly interesting and fast method for searching is to keep the data in a “digital trie.” a digital trie offers the prospect of being able to search for...
quick short method is a best one
Insertion sort method is the quick sorting technique
yaa i am writing the full program here for better understanding: This program will be run on Turbo C++ 3.0 without any error or warning.<-------------------------------------------------------...
struct node{int data;struct node * next;}list;for deleting a node from list first we have read a element which u want to delete and then we have identify previous node of that element.scanf("%d",&...