C is a general-purpose computer programming language used for operating systems, games and other high performance work.
4
votes
3answers
210 views
What is “short-circuiting” in C?
I have heard of the term "short-circuiting" being used in C. What does this mean and in what scenario would it be used?
1
vote
4answers
186 views
Languages that compile to C [closed]
What languages compile to C?
I like CoffeeScript which makes JavaScript easier to work with; what such things exist for C?
-1
votes
0answers
23 views
Book Suggestion - Debugging with GDB [closed]
Good day,
I would like to ask for a recommendation on a book for improving my abilities with GDB. So far, the obvious choice seems to be "Debugging with GDB: The GNU source-level debugger (GNU ...
-1
votes
0answers
39 views
Book Suggestion - Understanding Compilers [closed]
I have been doing software development in C and assembler for about 15 years. I would like to extend that knowledge by having a thorough understanding of various compiler flags and options. I know the ...
-1
votes
0answers
62 views
Looking for coding rules [closed]
I m looking for coding rules and security rules and verifications rules.
I m developing my programs with C on linux (user space applications)
Are there a standards for theses rules? Otherwise could ...
13
votes
3answers
839 views
How to solve the problem of nested comments
It appears in not just one language that comments can't be nested. Do you have a good solution for this problem? One workaround in C/C++ and Java is to only use the single-line comment but it becomes ...
2
votes
1answer
118 views
.c FIle Dedicated to Data
Is it completely unheard of to have a .c file dedicated to just data? In my case, I'd be using it for global variables that are shared across two other .c files. Here's specifically how I'm using it.
...
5
votes
4answers
558 views
I am incompetent; how can I fix it? [duplicate]
I program in C and I believe I know the language well. I understand all the concepts and my problems never come from misuse of the language.
I have problems because I always forget or oversee things. ...
-3
votes
0answers
15 views
turning off tooltips in code::blocks [migrated]
I want to turn off the tooltip in code::blocks that shows function prototypes when I'm typing functions because I can't see what I'm typing.
I went to Settings > Editor > Code Completion and unchecked ...
0
votes
0answers
31 views
Design for migrating to Multitenant architecture
We are in a process of redesigning our product code in such a way so as to support multitenancy.
Currently the implementation is such that one product deployment caters to only one customer.
Thus ...
3
votes
5answers
209 views
sizeof style: sizeof(type) or sizeof variable?
I've seen two styles of using sizeof for memory-related operations (such as in memset or malloc):
sizeof(type), and
sizeof variable or sizeof(variable)
Which one would you prefer, or would you use ...
6
votes
5answers
310 views
I believe I have mixed C and C++ code when I shouldn't have; Is this a problem and how to rectify?
Background/Scenario
I started writing a CLI application purely in C (my first proper C or C++ program that wasn't "Hello World" or a variation thereof). Around midway through I was working with ...
5
votes
3answers
197 views
Reason for placing function type and method name on different lines in C
I just started at a company and one of the style comments at my first code review was that the return type and method name should be on different lines. For example, this
void foo() {
}
should be ...
-5
votes
0answers
41 views
Error in the code snippet [closed]
void escape(char to[ ],char from[ ]) {
int i=0,p=0;
while (from[i] !='\0') {
switch(from[i]) {
case '\n':
to[p++]='\\';
to[p++]='n';
...
0
votes
0answers
45 views
How does a dynamic library's references to a static variable get translated once in the running app?
If a dynamic library exports the address to a global variable defined within the library, how are accesses to that variable translated during dynamic linking so that a running application can interact ...
2
votes
1answer
79 views
Evaluation order of the expressions
The C Programming Language by K & R states that C, like most languages, does not specify the order in which operands of an operator are evaluated. (The exceptions are &&,||,?: and ','). ...
0
votes
0answers
45 views
OpenGL ES 2.0 sharing esContext in C++ [migrated]
I am going through a seemingly popular book titled "ES 2.0 Programming Guide." In this book, there is sample code for a simple ES 2.0 program for drawing a triangle. Here is a snippet of the program ...
0
votes
0answers
60 views
How does indirection work in this code? [migrated]
I was reading the answer to Merging two sorted linked list.
The code:
#define SWAP_PTRS(a, b) do { void *t = (a); (a) = (b); (b) = t; } while (0)
Node* MergeLists(Node* list1, Node* list2)
{
...
-2
votes
0answers
40 views
socket programming using c and windows [closed]
Any one know how to do socket programming using c for windows OS? I know how to do it on linux but I want to do it using windows. Got any link tutorial links,libraries or API for that?
-1
votes
2answers
85 views
I'm trying to figure out which functions from one C library are being used by C project. Does anyone have a simple solution? [closed]
To be specific, I want to know which function/types in libpri and being used in the Asterisk project. I'm not traditionally a C programmer, but I know some basic stuff because I took a class in ...
0
votes
2answers
96 views
Giving a double type for sqrt library function in C
The C Programming Language by Ritchie says that:
The library routine sqrt expects a double type and will produce nonsense if inadvertently handled something else. So if n is an integer, we can use ...
0
votes
1answer
50 views
Implementation defined behaviour changing const type in c
The C standard states that if an attempt is made to change a const type,the result is implementation defined.This gives error on my system,but what does it depend on(compiler,os)?
What are the ...
1
vote
3answers
268 views
Violation of the C definition?
The C standard states that any character in the machine's standard printing set will never be negative.But the following code:
char c=1234;
printf("%d\t%c",c,c);
gives a negative output and prints ...
-1
votes
0answers
52 views
Send huge message with mpi [closed]
For testing purposes I want to simulate the transfer between 2 computers. With the framework MPI, the transfer should happen.
Normally, the message transfer between computers is very fast. In my ...
-1
votes
0answers
77 views
Can someone review my arduino code? [closed]
it's my first try to make a real project and I'm not really sure about how i wrote my code
It's a project about a domotics control system based on arduino, nothing great, it's only for test myself ...
-3
votes
0answers
46 views
to remoove the special characters from the text file using c [closed]
i have a text file name new.txt and it contains the following data
rs_rate :float32:=54;
rsv_rate :float32:=2;
ps2_rate :float32:=54;
rs_rate :float32:=2;
i want to remove the special ...
2
votes
1answer
206 views
Source code of jar.exe - is it available
This may seem an odd question, but I want to create an executable which runs under Windows written in C++. The program needs to be able to update a jar file even if Java is not installed on the ...
2
votes
4answers
362 views
Is Objective C a reasonable way to learn C?
I want to learn C but I tend to learn best when I have a project to work on. I've never done iPhone development, so I'm hoping to kill two birds with one stone. Will learning objective c also teach me ...
6
votes
1answer
399 views
Is this a valid example of a dangling pointer?
The book "Data Structures in C" (Horowitz and Sahni) suggests that in the following code the pointer pf is behaving as a dangling reference:
float f,*pf;
pf=(float*) malloc(sizeof(float));
*pf=2.6;
...
-3
votes
0answers
49 views
How can I print “d” of pop stack as a binary number? [closed]
#include <stdio.h>
#include <stdlib.h>
int push(int);
int pop(int);
int main()
{
int d,a,i=0,head=0,stack[head];
printf("GIVE AN INTEGER >0 AND <128 :");
do
{
...
0
votes
4answers
212 views
Char and unsigned char [closed]
Where is unsigned char used in C ( please tell about some real-world examples )? Why would we need both char and unsigned char?
Char ranges from -127 to 128 ( 8-bit integer )
Unsigned Char ranges ...
0
votes
0answers
40 views
Explanation of strange error in c [migrated]
Just as I compiled:
#include<stdio.h>
main()
{
print("hello\cworld");
}
I got this error/output:
warning:unknown escape sequence '\c'
...
1
vote
2answers
81 views
Where is interface between button click and event raising defined
When I click on button, might be in windows apps, web apps, etc it has some animation to actually see it clicked and event is raised in background. I've knowledge of events and its attaching to button ...
-1
votes
0answers
113 views
Learn Python or C/C++ or Objective-C first? [closed]
I'm going to university in the fall and I'll be studying computer science. I really love the idea of programming and making software in OSs. I've done some beginners programming in python/c/objective ...
-3
votes
2answers
377 views
Why is C++ preferred over C for commercial applications? [closed]
I program in C mostly. However, it is pretty obvious that many more commercial applications are done in C++.
As far as I can tell, C++ is a very complex language, with seemingly convoluted syntax and ...
11
votes
4answers
452 views
Is it possible to use the Intel C/C++ compiler on Linux to create object files to be linked on Windows?
Why?
Depending on your source the Intel compiler is likely or most definitely the compiler generating the fastest executables for the x86 architecture (5 to 100 % execution time improvement).
Intel ...
-3
votes
4answers
772 views
speed/performance of image processing python vs java vs c [closed]
I have a project in which I take a handful of images and coordinates, and combine them all into a single image based on those coordinates. (so not really image processing, just image ...
-1
votes
1answer
164 views
Language Learning: Well documented C projects? [closed]
I started to learn programming in Java. Most projects, especially the standard library, are documented quite well. So well, that you actually often don't need more then the HTML documentation to learn ...
3
votes
1answer
143 views
Storing the EOF (End of File) character in a char type
I read in the Dennis Ritchie's The C Programming Language book that int must be used for a variable to hold EOF – to make it sufficiently large so that it can hold EOF value – not char. ...
3
votes
2answers
168 views
Implementing non-fixed length array support in a compiler
I'm thinking of building a language for PIC microcontrollers. I want to be able to use non-fixed size arrays, like this:
Declare the variable as int[]
Wait for input from serial connection
Make the ...
0
votes
0answers
81 views
Help With Socket Programming In C [closed]
So, today i thought i would try something new, and play with windows sockets. I found a tutorial on the internet http://www.binarytides.com/winsock-socket-programming-tutorial/
Problem is, that ...
5
votes
2answers
870 views
Why the ugly keywords in C11?
I am currently reading a draft of the C11 specification. The new introduced keywords: _Bool, _Alignof, _Atomic all feel like custom extensions, instead of standard reserved keywords like struct, ...
10
votes
4answers
669 views
Why do some programmers categorize C, Python, C++ differently? - regarding level [duplicate]
I am taking an introductory course on python and the instructor says that python is a high level language and C and C++ are low level languages. It's just damn confusing. I thought that C, C++, ...
-2
votes
1answer
210 views
Is C a pre-requisite in order to learn C++ effectively? [duplicate]
I only have programming experience with high-level languages, as well as with DBMS. Now, I would like to get into C and/or C++. My question is: Is the C language a pre-requisite in order to learn C++ ...
0
votes
1answer
189 views
Did I answer this correctly and concisely? [closed]
By email I just answered my brother who is learning computer programming that C++ and Java are more similar than C and C++ even though C++ is nearly a superset of C. Do you agree?
AFAIK Stanley ...
-1
votes
1answer
298 views
Object-Oriented Programming With ANSI-C [closed]
I am trying to expand my understanding the history and involvement of OOP.
Recently I have been looking into OOP in ANSI-C, which is described in Object-Oriented Programming With ANSI-C by Axel ...
-2
votes
1answer
116 views
C program why doesnt this work help? [closed]
I have to write a program which shows the following expressiob
P=(1/2-3/4)(5/6-7/8)...*(n)/(n+1)-(n+2)/(n+3)..
I tried this
#include <stdio.h>
int main ()
{
float s,p;
int i,n;
...
-2
votes
1answer
143 views
What is wrong with my program c language? [closed]
I have to write a code which displays and calculates S=1+1/2+1/3+1/4 .. for a given n.
There is smth wrong with my code ,I compile it but the result isnt what I want
#include <stdio.h>
int main ...
4
votes
3answers
233 views
How hard is it to migrate if one has practiced C/C++ only on Windows & never in Unix-like OSes like Linux? [duplicate]
I was confused about whether to post it on Meta or here, but then decided the latter. In compliance with SO T&C, I don't intend to debate which is better. I only need an objective & technical ...
-4
votes
1answer
87 views
C programming question help please? [closed]
What does the expression S+=i*(2*(i%2)-1) mean while writing a code in C?
I know that % 2 mean dividing something and the remainder is our answer but how about the whole thing?




