How does one draw a triangle in C console?
#include<stdio.h>
void main()
{
int row,column,add,sub,h,noofrows,noofcolumns,j,finish;
printf("how many rows do you want in your triangle\n");
scanf("%d",&noofrows);
noofcolumns=noofrows-1;
for(row=1;row<=noofrows-1;row=row+1)
{
for(column=-noofcolumns;column<=noofcolumns;column=column+1)
{
add=row+column;
sub=row-column;
if(add==1sub==1)
{
printf("*");
}
else
{
printf(" ");
}
}
printf("\n");
}
finish=((noofrows+noofrows)-1);
for(j=1;j<=finish;j=j+1)
{
printf("*");
}
scanf("%d",&h);
}
How do C and C plus plus differ in terms of data abstraction and classes and structs?
They differ insofar as C does not use object-oriented programming at all -- there are no classes (only structures), therefore there was nothing to abstract. C++ (which literally means 'the successor to C') is an extension of C that primarily adds object-orientated support to the language. Everything you can do in C you can also do in C++, but with the added benefits of OOP you can do a whole lot more, more easily, including the creation of abstract data types.
Every complete statement ends with a?
Any teacher will expect you to answer by saying a semicolon (;), but this is not strictly true. First of all, the definition of a "line of code" varies from teacher to teacher and textbook to textbook. Second, even the Java Language Specification lists several types of Java statements which do not need to end in a semicolon.
In general, a complete Java statement will end in either of semicolon or a closing block brace.
Design the logic code for program to print numbers in reverse order from 10 down to 1?
Enter values and end of the list enter -1 to see output. but execute it at command line.
<?php
function readData(){
fwrite(STDOUT, "Please enter your name\n");
// Read the input
$name = fgets(STDIN);
if($name != -1)
readData();
fwrite(STDOUT, "Hello $name");
return;
}
readData();
?>
start
num Sub
num Size = 10
index = 0
while index<10
index = index + 1
endwhile
while index > 0
index = index - 1
endwhile
print Sub
stop
What is a sparse matrix in c programming?
Sparse matirx can be represented 1-dimensionally, by creating a array of structures, that have members sumc as: Struct RM{int ROW,int COL, int non_zero}; struct RM SM[Number_non_Zeros +1]; then input row,col for each non-zero element of the sparse matrix. if still unclear please fell free to requestion or query on ikit.bbsr@gmail.com, specifying clearly the question in the subject. Chinmaya N. Padhy (IKIT)
What are Different types of assembly language statements?
The three types of assembly language are:
1. Imperative: indicates an action to be performed.
2. Declaration
3. Assembler Directives
32 how many arrays can you make?
You shouldn't wikianswer your homework, tardface. I can eat a pineapple in less than 2 minutes.
In a doubly linked list, you can iterate backwards as easily as forwards, as each element contains links to both the prior and the following element. You can also insert or delete an element without needing to iterate and remember the prior element's link. This comes at a cost. You are adding storage to each element for the second link, and you are adding processing overhead to the insert and delete operation. You have to determine the tradeoff.
What are the advantages of insertion sort?
It is less efficient on list containing more number of elements.
As the number of elements increases the performance of the program would be slow.
Insertion sort needs a large number of element shifts.
What development tool that helps programmers write compile and test their programs?
Microsoft Visual Studio comes with Visual Basic,Visual C++ etc.You can use them to create programs.
Why you define static data member in global declaration?
Defining a static data member in a global declaration allows for its visibility throughout the entire file while restricting its linkage to that file only. This means that the static member can be accessed by all functions and classes within the same translation unit but cannot be accessed from other files, promoting encapsulation. It helps in managing shared data while preventing name clashes in larger projects. Additionally, it aids in maintaining a single instance of the data member, conserving memory and ensuring consistent behavior.
Why pointers are called derived data type?
Pointers are called derived data types because they derive their meaning from the type of data they point to, rather than holding a direct value. Specifically, a pointer stores the memory address of another variable, allowing for indirect access to that variable's data. This relationship enables more complex data structures, such as linked lists and trees, to be created and manipulated in programming. Additionally, pointers facilitate dynamic memory allocation, enhancing the flexibility and efficiency of memory management in applications.
What has been strongest influence on programming language design?
The strongest influence will always be the need and the demand for it.
for instance, with regards to security, if there are so many virus or hack attacks
then definitely a new security program is needed.
another is if the current program cannot handle the growth of a company
then a new set of programs is in order.
and then there is the cost of maintaining a program.
why pay more when one can get it for a much cheaper program.
Program to find the size of the string in c?
int main (void) {
char buf[1024];
scanf ("Enter a string: %s", buf);
printf ("The length of the string is %d chars long.\n", strlen (buf));
return 0;
}
What translates a high level language into machine code?
An interpreter or a compiler. The former translates one line at a time and must be executed within the interpreter. The latter compiles the entire program into a standalone executable. For example, C++ is compiled to machine code but Java is compiled to byte code which is then interpreted by the Java Virtual Machine.
Why single pass compiler are faster than multi pass compiler?
What are advantages and disadvantages of union in c language?
A union in C++ is similar to a C-style union in that the members of the union are all mapped to the same memory address. In other words, if you were to unify a long with a char, the char would be mapped to the first byte of the long. However, unlike C unions, C++ unions can be derived from other unions, structs or classes, as well as act as base classes for derived unions, structs and classes.
What are the advantages of dynamic memory allocation over static memory allocation?
Readers who are familiar with the concepts of dynamic memory and pointers may wish to skip to the next section of this chapter. In this one, the general concepts of static and dynamic memory is outlined. How these issues are specifically handled in Modula-2 is not taken up again until after the rest of the preliminary discussions are complete.
The distinction made in this section is based on the timing and manner for the setting aside of memory for the use of a program. Some memory use is predetermined by the compiler and will always be set aside for the program in exactly the same manner at the beginning of every run of a given program. Other memory is obtained by the program at various points during the time it is running. This memory may only be used by the program temporarily and then released for other uses.
What are two functions of the CSF?
The functions of the spinal fluid are to cushion or protect the brain from any trauma, provide the necessary nutrients and chemicals to nervous system tissue, and the removal of waste product from the brain. The cerebrospinal fluid is a colorless fluid found in the brain and spinal cord.
How c language is used in real life?
In "real life" as opposed to what?
C is a programming language. It's used to write computer programs. It (and variants, like C++ and C#) are used to write probably the majority of programs in use today.
How can i improve my grammar skill?
Reading books is probably the best way to improve language skills
How sparse matrix can be stored using array?
#include<stdio.h>
int main()
{
int a[20],min,max;
int n;
printf("\nEnter the num of elements: ");
scanf("%d",&n);
printf("Enter the elements\n");
for(int i=0;i<n;i++)
{
scanf("%d",&a[i]);
if(i==0)
{
min=max=a[i];
}
if(a[i]<min)
min=a[i];
else if(a[i]>max)
max=a[i];
}
printf("The largest element is %d. The smallest element is %d.", max, min);
}