answersLogoWhite

0

📱

C Programming

Questions related to the C Computer Programming Language. This ranges all the way from K&R to the most recent ANSI incarnations. C has become one of the most popular languages today, and has been used to write all sorts of things for nearly all of the modern operating systems and applications. It it a good compromise between speed, power, and complexity.

9,649 Questions

What is the benefit of float data type?

Floating type numbers can't be stored in integer type variables. If we do that then their fractional part will be lost. So, we use float data type to store numbers with fractional parts.

Important topics in c plus plus?

Object-oriented programming (OOP) would have to be top of the list of important topics in C++, since OOP constitutes a major portion of all C++ programs. The C++ standard library is heavily reliant upon OOP. Templates are the next most important topic, as these allow you to write code in a more generic manner. The C++ standard template library (STL) relies heavily upon templates. The closer you stick to the standard library, the easier it is to port code between compilers. However, familiarity with the correct usage of macros will aid in writing portable cross-platform code.

Whilst learning these topics you will be introduced to C-style programming. It is not necessary to know C before learning C++ (indeed, it is better to not know C at all), however the C++ built-in types (primitive data types) are primarily inherited from C. C itself is a low-level language, but C++ is every bit as efficient. Thus it is best to get into the habit of writing good C++ code first, and using C only where it is deemed necessary.

Why all variables are declared with in the function?

It is not necessary to to declare variables inside the function in C. If you declare a variable inside a function, the variable becomes local for the function and another variable of same name can be declared in any other function, but you can not use the variable declared in other function. When you declare any variable outside the function body then the variable becomes global and can be used in any function of the program.

Note: errno is an example for a variable declared outside any function.

How you can modify an integer variable value in a function?

with an assignment:

variable = value

variable += value

variable /= -3;

...

What is ii.h.ah in union regs function in C programming?

I guess it is a char or an unsigned char. When calling MS-DOS/BIOS interrupts, it represents the value of the AH register.

Difference between continuous and contiguous?

contiguous is "separated in space" and continuous is "separated in time"

Does a number stored as an integer take up less space in the computer's memory than a floating points number?

It depends on the particular implementation's representation of integer and floating point number. The IEEE 754-2008 standard provides four basic resolutions, 16 bits (not common), 32 bit, 64 bits, and 128 bits (also not common). At the same time, integers can be 8 bits, 16 bits, 32 bits, 64 bits (in 64 bit platforms and some libraries on 32 bit platforms) and 128 bits (not common).

In general, if you want to keep resolution down to the units digit, you can store a larger number in an integer than you can in a floating point, due to overhead in the exponent, but, at the same time, due to the scalability of floating point numbers, you can store larger numbers in floating point numbers if you are willing to lose resolution on the low-order end.

What is the difference between advanced encryption algorithm and encryption algorithm?

People have developed many encryption algorithms.

One particular encryption algorithm is the Rijndael algorithm, usually called the AES or Advanced Encryption Standard.

How do you copy the contents of string str 2 into str 1 using C programming?

#include<stdio.h>

#include<string.h>

#include<conio.h>

void main()

{

char str1[10],str2[10];

printf("Enter string.\n");

gets(str2);

strcpy(str2,str1);

printf("Copied string is %s",str1);

getch();

}

What do you mean by ''GIGO'' in computer education?

GI/GO is a computer programming term for Garbage In/Garbage Out. It means that if you have incorrect data input, then your output will be incorrect

What is a hole-in-scope?

when inner declaration of a variable hides its outer declaration

What happens if you accidentally include any header file twice in C programming?

You get many error/warning messages. That's why headers always have a frame like this:

#ifndef HEADERNAME

#define HEADERNAME

... actual content ...

#endif

This way multiple inclusions won't cause any trouble.

What is thread pointer?

It is a pointer.You can pass a smart pointer from one thread to another, and the two threads are free to use their smart pointers just as they were native pointers. They can copy them, assign them, and do whatever they want with them, and the smart pointer will not get you into trouble.

What types of charts can you create from data in a spreadsheet?

Spreadsheet packages may chart one set of data in the form of a pie chart, or two or more sets of data in bar charts (with vertical bars, horizontal bars, or stacked bars), line charts, area charts, or mixed charts, which combine bars and lines

What is the total size of memory allocated for structure variable?

Depend on the elements of you struct. Say i have struct a { int a, int b}. Total size is : 4 + 4 = 8 bytes.

What is the meaning of platform depended in c?

The program compiled on one platform may not run in another platform.