Found 1339 Articles for C

What does int argc, char *argv[] mean in C/C++?

Chandu yadav
Updated on 24-Jun-2020 06:12:03

8K+ Views

argc stands for argument count and argv stands for argument values. These are variables passed to the main function when it starts executing. When we run a program we can give arguments to that program like −$ ./a.out helloExampleHere hello is an argument to the executable. This can be accessed in your program. For example,#include using namespace std; int main(int argc, char** argv) {    cout

Why do we use extern "C" in C++ code?

Priya Pallavi
Updated on 30-Jul-2019 22:30:22

1K+ Views

You need to use extern "C" in C++ when declaring a function that was implemented/compiled in C.Using extern "C" lets the compiler know that we want to use C naming and calling conventions. This causes the compiler to sort of entering C mode inside our C++ code. This is needed because C++ compilers mangle the names in their symbol table differently than C compilers and hence behave differently than C compilers.

Is C++0x Compatible with C?

Srinivas Gorla
Updated on 30-Jul-2019 22:30:22

137 Views

Neither C++ (98) nor the new standard(C++0x or C++11) is fully compatible with C. C++ never was fully compatible with C.

How can I write in order with for loop or while loop?

Arnab Chakraborty
Updated on 20-Jun-2020 15:34:17

260 Views

Example#include #include void main() {    int i,j,a=0,b=1,n;    clrscr();    printf("****************OUTPUT*****************");    printf("enter the value of n : ");    scanf("%d",&n);    printf(" the required order is: " );    for(i=1;i

How do I set up C/C++ on Eclipse in Windows?

Arushi
Updated on 26-Feb-2020 11:21:22

10K+ Views

Step 1 − Install MinGW GCC or Cygwin GCCTo use Eclipse for C/C++ programming, you need a C/C++ compiler. On Windows, you could install either MinGW GCC or Cygwin GCC. Choose MinGW if you are not sure, because MinGW is lighter and easier to install, but has fewer features.MinGW GCCTo install MinGW, go to the MinGW homepage, www.mingw.org, and follow the link to the MinGW download page. Download the latest version of the MinGW installation program which should be named MinGW .exe.While installing MinGW, at a minimum, you must install gcc-core, gcc-g++, binutils, and the MinGW runtime, but you may ... Read More

When to use C over C++, and C++ over C?

Akansha Kumari
Updated on 11-Jun-2025 18:10:20

1K+ Views

Both C and C++ are powerful programming languages that are used by developers to write both system-level and high-level programs. C language follows procedural programming paradigm with a simple and structured approach, whereas C++ supports both procedural and object-oriented programming. Although both C and C++ are widely used across various fields for developing different types of system and application software but they have different strength and use cases. In this article, we will learn when to use C over C++, and when C++ is a better choice than C. When to use C Language? When ... Read More

What is the difference Between C and C++?

Alankritha Ammu
Updated on 10-Feb-2020 11:19:15

1K+ Views

Following are some of the differences between C and C++.When compared to C++, C is a subset of C++. All valid C programs are valid C++ programs.C is a structural or procedural programming language, while C++ is an object oriented programming language.In C, Functions are the fundamental building blocks, while in C++, Objects are the fundamental building blocks.C doesn't have variable references, while C++ has variable references.C uses malloc and free for memory allocation while C++ uses new and delete for memory allocation.C does not provide direct support for error handling, while C++ supports exception handling that helps in error ... Read More

How to wrap python object in C/C++?

Gireesha Devara
Updated on 24-Aug-2023 16:01:06

537 Views

To wrap existing C or C++ functionality in Python, there are number of options available, which are: Manual wrapping using PyMethodDef and Py_InitModule, SWIG, Pyrex, ctypes, SIP, Boost.Python, and pybind1. Using the SWIG Module Let’s take a C function and then tune it to python using SWIG. The SWIG stands for “Simple Wrapper Interface Generator”, and it is capable of wrapping C in a large variety of languages like python, PHP, TCL etc. Example Consider simple factorial function fact() in example.c file. /* File : example.c */ #include // calculate factorial int fact(int n) ... Read More

What is the difference between ++i and i++ in c?

Jayashree
Updated on 12-Sep-2023 02:57:07

38K+ Views

In C, ++ and -- operators are called increment and decrement operators. They are unary operators needing only one operand. Hence ++ as well as -- operator can appear before or after the operand with same effect. That means both i++ and ++i will be equivalent.i=5; i++; printf("%d", i);and i=5 ++i; printf("%d", i);both will make i=6.However, when increment expression is used along with assignment operator, then operator precedence will come into picture. i=5; j=i++;In this case, precedence of = is higher than postfix ++. So, value of i is assigned to i before incrementing i. Here j becomes 5 and i becomes 6.i=5; ... Read More

Advertisements