Is there any program that can run c but not in c plus plus?
== Yes. It may be funny. You cannot use keywords like newin c++ for variable declaration. But in C it is possible.
== The following definition is valid in C, invalid in C++: char str [3] = "ABC";
What are the limitations of the C programming language?
An algorithm simply describes the finite, procedural steps required to solve a problem. Algorithms are not specific to any one programming language, but without algorithms there would be no computer programs let alone programming languages. That is, you cannot program a computer to solve a problem unless you know how to solve the problem yourself and for that you need to know the algorithm. Once you have the algorithm, you can program the computer to implement it.
What do you understand by static memory allocation and dynamic memory allocation?
MEMORY ALLOCATION MODELS……
STATIC MEMORY ALLOCATION DYNAMIC MEMORY ALLOCATION
Memory is allocated before the execution of the program begins.
(During Compilation)
Memory is allocated during the execution of the program.
No memory allocation or deallocation actions are performed during Execution.
Memory Bindings are established and destroyed during the Execution.
Variables remain permanently allocated.
Allocated only when program unit is active.
Implemented using stacks and heaps.
Implemented using data segments.
Pointer is needed to accessing variables.
No need of Dynamically allocated pointers.
Faster execution than Dynamic.
Slower execution than static.
More memory Space required.
Less Memory space required.
What is the difference between an array of structures and an array within a structure?
The main differences between an array and a structure are:
An Array is a collection of similar data items.An array is derived data type.It behave like a built in data type. An array can be increased or decreased.
A structure is a collection of dissimilar data items.It is a user defined data types.It must be declared and defined.A structure element can be added if necessary.
A first-generation contact language is called a?
A first generation contact language is called a pigdin. The feature of human language that allows people to talk about the past and the future is referred to as displacement.
What is the difference between javascript and C programming language?
Mainly JavaSript is a low-level scripting language that differs from the high-level languages in its easiness. The core language is really simple, and is designed to be easier for beginners,
I.e. JS i loosly typed. Meaning that a variable can reference any kind of literal, array or object, which differs from the high-level C-languages where you have to declare if a variable i to reference an integer, floating-point, string, hash-map and so on.
Another major difference is that JS, like python or php isn't compiled to machine code, but interpreted at runtime, making programs run significantly slower than compiled programs.
Another difference which is good, and unique to JS is that it does not inherit the C class model when working in OOP. Objects in JavaScripts can be crated and altered as one want to, beeing more dynamic to work with. A classical model can however be adopted with use of functions and use of the 'new' keyword. Here the lack of private variables can be worked around by the use of a technique called 'closure'.
The major difference however is that programs written in JS to work with the HTML DOM tend to not follow the normal procedural 'step-by-step' executions as conventional programs, where one line of code is being executed at the time. In stead JS tend to follow a Event Loop model, where different parts of the programs are attached to different DOM events. The JS-program will then sleep until a event is fired, then wake up, do its job, then go back to sleep. And so on. All in all making JS a very dynamic and "fun to work with" language.
A compiler and a linker.
Difference between conventional OS and embedded OS?
Conventional OS aim to give users the ability to run other software that are interactive in nature to perform different tasks. On the other hand, embedded OS only run fixed set of tasks and deliver the expected results in real time.
List of command used in c language?
It's easy: there are no commands in C, but a few statements (such as: expression, if, else, switch, while, do-while, for, break, continue, return and goto), and countless library functions (like printf, malloc and fopen).
What do you mean by c taken programming in c?
A C program is a computer program written using the C programming language.
Write your own c plus plus functions for the following problem Print the sort output on the console?
#include<iostream>
#include<vector>#include<string>
int main()
{
std::vector<std::string> names;
for (int loop=0; loop!=10;)
{
std::cout << ++loop << " enter a name: ";
std::string name;
std::cin >> name;
names.push_back (name);
}
names.sort();
std::cout << "Sorted names:" << std::endl;
for (auto name : names)
std::cout << name << std::endl;
}
What are the steps involved in system approach to solve the problems?
If this is Mathematical, or Physics, Chemistry numericals you are talking about then, 1---> Read the problem. 2---> Identify the question or what has to be found out. 3---> Read the data given in the problem and analyze it. 4---> See if you know any formula/concept that can help you use the data given in the problem. 5---> Apply, solve carefully. Obtain result.
Time and space complexities of various sorting methods?
Bubble sort-O(n*n)-in all cases
Insertion sort-O(n*n)-in avg and worst case in best case it is O(logn)
Quick Sort-0(nlogn)-in avg n best case and 0(n*n)-in Worst case
selection sort-same as bubble
Linear search-o(n)
Binary Search-o(nlog)
Any doubt mail me-jain88visionary@rediffmail.com
How do you Calculate the average of two numbers then return the average in c plus plus?
Use the following function:
/* returns the average of two real numbers */
double average (const double a, const double b) {
return a/2.0 + b/2.0;
}
Note that we do not use (a+b) / 2.0 because the expression a+b could overflow the range of a double. By dividing each value by 2 before summing we ensure the result can never overflow no matter how large a and b are.
Ideally, you should write separate functions to cater for float and long double arguments independently:
/* returns the average of two long doubles */
long double average_lng (const long double a, const long double b) { return a/2.0 + b/2.0;
}
/* returns the average of two floats */
float average_flt (const float a, const float b) {
return a/2.0F + b/2.0F;
}
For mixed-mode arithmetic, always use the highest precision argument. E.g., the average of a float and a double is a double, so use the function that returns a double, not a float. The float argument will be implicitly cast to a double.
What is difference between multi character constant and string literals?
In C, you can assign integers multiple characters such that they fit in their size. For e.g.:
int - 4 bytes
char - 1 byte
So an assignment like this is valid:
int a = 'ABCD';
The first byte in a will be assigned the value of 'A', the second - 'B' and so on.
A string literal is a character array constant. It is enclosed in double quotes and assignment can only be made to a char pointer. There is no limit on the size of the literal and it is terminated with a null character. e.g.:
char str[] = "This is a trial";
What are the names of computer programming courses?
Answer-
There are various levels of computer programming courses conducted by computer schools. As per your career goals you can do diploma, associate, bachelor or master degree courses in computer programming.
How many data types can the elements of an array have?
Depends on your language. Assuming java: If you make it an Object[] then it can contain any object
For primitive types you must either make a primitive type array, ie double[], char[] which can contain only those primitives, or creater an Object[] and use primitive wrapper objects ie java.lang.Integer etc.
How is an array name interpretedwhen it is passed to a function?
An array is still an array, regardless of how you pass it into functions. It is still an array-type variable at the beginning of a function. However, the function itself may manipulate the array by "imploding" it into a string with a delimiter, using array values with only specific keys, and such.
What is the base address of an array in c program?
the address of variable (pointer) that contains array
It's -1, but in theory could be something else on some exotic platforms, but still negative. See the related links below for further information.
Difference between C and C plus plus languages?
C was the C++ predecessor. As it's name implies, alot of C remains in C++. Although not actually being more powerful than C, C++ allows the programmer to more easily manage and operate with Objects, using an OOP (Object Oriented Programming) concept.
C++ allows the programmer to create classes, which are somewhat similar to C structures. However, to a class can be assigned methods, functions associated to it, of various prototypes, which can access and operate within the class, somewhat like C functions often operate on a supplied handler pointer.
Although it is possible to implement anything which C++ could implement in C, C++ aids to standarize a way in which objects are created and managed, whereas the C programmer who implements the same system has alot of liberty on how to actually implement the internals, and style among programmers will vary alot on the design choices made.
In C, some will prefer the handler-type, where a main function initializes a handler, and that handler can be supplied to other functions of the library as an object to operate on/through. Others will even want to have that handler link all the related function pointers within it which then must be called using a convention closer to C++.
To finish this discussion, C++ applications are generally slower at runtime, and are much slower to compile than C programs. The low-level infrastructure for C++ binary execution is also larger. For these reasons C is always commonly used even if C++ has alot of popularity, and will probably continue to be used in projects where size and speed are primary concerns, and portable code still required (assembly would be unsuitable then).
What is null pointer assignment?
This error message means that somewhere in your program you have used a pointer-varible containing NULL-value. (Within an actual OS it with stop the program immediately, but in MS-DOS it doesn't.)
How compilation and linking and loading related in c?
Compilation is the act of translating high-level programming language code into low-level native machine code. Computers cannot execute high-level programming language code, it must be converted to native machine code first. In C, this is achieved using a compiler that is specific to the machine. However, the compiler only produces object code files. In order to produce a machine code executable, the object files must be linked along with any required library code. This is achieved by another machine-specific program called the linker.
Why else if ladder bettar than switch?
The if/else ladder construction is not better than a switch. However, in some cases one is preferred. Switches for instance usually execute faster since the compiler can optimize such constructions better. This is because the compiler doesn't have to take into account any programmer forced orders of execution.
The if/else ladder is preferred where the conditions to be checked are not fixed.
So, it all depends on the situation.