How do you print the elements of singly linked list-program?
#include<stdio.h>
#include<conio.h>
#include<alloc.h>
#define NULL 0
int item,ch;
struct slink
{
int data;
struct slink *next;
}
*start,*new,*l;
main()
{
clrscr();
start=NULL;
printf("\n**MENU**");
printf("\n1.CREATE \n2.PRINT \n3.EXIT ");
while(1)
{
printf("\nENTER YOUR CHOICE: ");
scanf("%d",&ch);
switch(ch)
{
case 1: create();
break;
case 2: print();
break;
default: exit();
break;
}
}
getch();
}
create()
{
start=NULL;
l=start;
printf("\nENTER THE DATA: \n");
scanf("%d",&item);
while(item!=0)
{
new=malloc(sizeof(struct slink));
new->data=item;
new->next=NULL;
if(start==NULL)
{
start=new;
l=new;
}
else
{
l->next=new;
l=l->next;
}
printf("\nENTER 0 TO TERMINATE: \n");
scanf("%d",&item);
}
}
print()
{
l=start;
while(l!=NULL)
{
printf("%d--> ",l->data);
l=l->next;
}
}
Constructor cannot be virtual but destructor can be virtual justify?
bcoz constructor cant be invoked
Can element of character arrays be accessed in the same way as the elements of a numeric arrays?
Yes, it can.
Why you divide a program into functions?
In order to make a large program more manageable, it is convenient to identify and isolate specific tasks that a program performs and to separate out those tasks into functions. These functions are used/invoked as needed by the main part of the program. They can also be invoked by other functions. Often a program will perform the same task in different parts of the program. Using a function to perform the task and invoking the function from the different parts of the program means that only one copy of the code is needed. This helps reduce the size of the program.
A physical node system refers to a tangible, identifiable unit within a network or distributed computing environment that performs specific functions or tasks. Each physical node, such as a server or device, is equipped with its own hardware resources like CPU, memory, and storage, and can communicate with other nodes. This system enhances scalability, reliability, and performance by distributing workloads across multiple physical nodes, allowing for better resource management and fault tolerance.
What do you mean by multiple compilation?
Whenever you change the source, you have to re-compile it, to get a new object/executable.
the esophagus is the kagaguhan of the boy
Could anyone mail you the C program for COS and sin series. Here the answer is not working?
Sorry, but no. The WikiAnswers philosophy is to share questions and answers with the community at large. It would not make sense to eMail answers to single entities. We also do not support specific identifying information in questions or answers, so the alternate question that contained an eMail address has been deleted.
Can an array of pointers to strings be used to collect strings from the keyboard?
Yes, u can do so. But you need to allocate memory to it. For exampe if you declare it like
char *myarr[4];
It is an uninitlized array of pointers. If you use it direct. You will get error.
You need to allocate memory to it. And then you can use it.
Here is the code
char *ab[4];
for (int j=0; j<3; j++)
ab[j]=(char *) malloc(10);
for (int j=0; j<3; j++)
scanf("%s", ab[j]);
for (int j=0; j<3; j++)
printf("%s\n", ab[j]);
Hope that helps
Example:
prefix: * 2 + 3 4
infix: 2 * (3+4)
postfix: 2 3 4 + *
I guess it would be the LSB, the bit that represent value 20=1
How matrices can be represented using two dimensional array?
You've pretty much answered your own question because a two-dimensional array is a matrix. Indeed, all multi-dimensional arrays are matrices.
When we create a matrix, we generally know what type of data will be stored in the matrix, how many dimensions it will have and how many elements each dimension will have, thus an array is the ideal container to represent a matrix. It provides the most compact method of storing homogeneous data, provides efficient constant-time random access to the data and introduces the least amount of abstraction into the representation.
Most languages do not provide a built-in matrix type, however this is simply because there is no one matrix type that would suit every possible application. However, all languages do provide a built-in array mechanism which can be used as the basis for any matrix type which is both simple to create and easy to maintain.
How do DriveSpy specify file headers?
The file header section conatins the hexidecimal number values for many knownfile types. These hexidecimal numbers are the header data contained in the first several bytesof all specialized data files, such as Microsoft word documents or excel spreadsheets and any associated templates. The file header uniquely identifies the file type.
You can use the file header information in Drivespy to search for specific files that might have had their extensions changed.
Write a program to concate the string without using strconcat function?
If you don't need to preserve the first string you could just iterate over the second string and copy each character onto the end of the first string, then return that
#include<stdio.h>
#include<stdlib.h>
#define NULL 0
struct info
{
int info;
struct info *next;
struct info *prev;
};
struct info *start,*end;
void main()
{
struct info *ptr;
if(start==NULL)
{
printf("linklist is empty");
}
else
{
ptr=(struct info *)malloc(sizeof(struct info));
ptr=start;
if(start==end)
{
start=NULL;
end=NULL;
}
else
{
start=start->next;
start->prev=NULL;
}
free(ptr);
}
}
This is not a question; it is not even a complete sentance. Please ask again using words that indicate what you want to know. Also, ensure you put it in the correct category, so you can get a meaningful answer.
"run time" is the opposite of "compile time". It refers to the time when the program is actually running.
Any violation in the syntax of a program statement is called logic error?
No. A violation in the syntax of a program statement is called a syntax error.