Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

c programming

  1. E

    Project: chess at C

    Helo, I'm new to programming, I'm in the first semester of Computer Science. I need to deliver a project by the end of November: developing a complete chess game in just C. I would like to know if anyone has any tips, sources, books, guidance because, honestly, I don't know where to start and...
  2. X

    C [C] byte address range.

    Hello ! I am struggeling with understanding how this works : #include <stdio.h> #include <stdlib.h> int main() { int rows = 2; int columns = 5; int **matrix = (int **) malloc(rows * sizeof(int *)); matrix[0] = (int *) malloc(rows * columns * sizeof(int)); for (int i = 1...
  3. X

    I don't understand multi dimensional arrays using pointers and pointers in arrays

    I tried to understand these two codes : int *pv = (int*) malloc(5 * sizeof(int)); for(int i=0; i<5; i++) { pv[i] = i+1; } This is a one dimensional array. And I am confused of how malloc works and why it is also a pointer (int *) ?? Because I had more simple examples such as...
  4. soda2718

    (BEGINNER) Dynamic Array Size Problem??

    Hello I am new to coding and was just wandering why the below code: #include <stdio.h> int main() { for(int i = 0; 1 ; i++) { char x; char z[1+i]; x=getchar(); if (x == '\n'){ *(z+i) = '\0'; printf("%s",z); break;} *(z+i) = x; printf("%s, %d = %c, i = %d\n",z, (z+i),*(z+i),i); } return 0; }...
  5. M

    Meme Generator in c

    Dear all! I have a very important question for my assignment: My assignment wants me to program a meme generator in c I need to read in a PPM Picture in two formats (binary & ASCII) In general, does anyone know, where I can inform myself on how to program a Meme Generator in c? Can I...
  6. Hilton D

    C++ What is the purpose of the keyword 'inline' in C?

    I read multiple Scaler & StackOverflow questions regarding inline in C but am still confused. There is no practical difference between static inline void f(void) and static void f(void). In C, inline void f(void) does not operate as it does in C++. In C, how does it work? What does extern...
  7. Hilton D

    C++ The complexity of string concatenation in C++ and Java

    Consider the following code: public String joinWords(String[] words) { String sentence = ""; for(String w : words) { sentence = sentence + w; } return sentence; } Because each concatenation generates a new copy of the string, the overall complexity is O(n2). Fortunately...
  8. Abilesh

    Designing my application

    The problem that I am facing now is how to design & structure my project. Here is brief explanation of the roles of my application. It executes a child process and controls them using ptrace. Thus I would be doing things like peeking, poking of the child process's address space. I would also be...
  9. xanderbilla

    What I'm missing here?

    //Inserting value at the end #include <stdio.h> void main() { int i, upper_bound, n, value, arr[10] = {10,20}; n = sizeof(arr)/sizeof(arr[0]); printf("Please give upperbound value: "); scanf("%d", &upper_bound); for (i = upper_bound+1; upper_bound == n ;i++) {...
  10. S

    C Conditions for printf()?

    Hello, I'm fairly new, and I was wondering, why does !(printf("Hello world")); still print "Hello world? Even though it's using the logical NOT operator... As well as if it was used as a condition in a while() loop... while(!(printf("Hello world"))) {} Why does it print only once? I thought...
  11. EkBass

    Trying to convert (int) for js

    Hi folks. Porting some C code here for js and im now not sure am i doing it right. The C code is as follows rx = (((int)px >> 6) << 6) + 64; Does that (int) affect only for px in this case, or does it affect to the rest of the line? Tried to google C (int) but that only leads me to pages...
  12. S

    Code execution

    Hello, everyone! What value will x have, after the following code gets executed? char n1 = 0xF1; char n2 = 0x1F; char x = 0; x = n1 & n2; I think it's 0, but I'm not exactly sure. What do you guys think?
  13. Vishaka

    Coding for mathematical function

    I have a function f(t)= e^(−5) e^(−5cos cos(t)) e^(10cos(t)) e^(−5sin sin(t)) I need to find the value of f for different values of t. Let us say from t=0 to t=5. How to write coding for that? I just know some basics of C.
  14. D

    Tutorial Simple Guessing Game In C[TUTORIAL]

    Hey everyone. Welcome to this C-Programming Tutorial. In today's Tutorial, I'm going to be showing you how to make a simple Guessing Game in C. Let's begin. First of all, choose where you want to store your Files. Is it in your Documents Directory, a separate Hard-Drive, choose where it will...
Back
Top Bottom