C programming Definition and 116 Threads

  1. C

    Why declarations in <stdio.h> aren't implemented?

    In the C programming language any .h file is a file that contains constants and/or function declarations ( but no implementations, besides inline functions ). That means that when I write #include <foo.h> at the start of my .c file, I'll have to implement all those function declarations (...
  2. D

    Python How does one assess progress when learning a programming language?

    I'm a physics major (Junior) who would like to learn a programming language. Many suggest Python as a good starting language, so let's suppose that is the language I want to first learn. This isn't for employability or general usefulness; rather, I'm just curious. How exactly does one go about...
  3. ergospherical

    Other Should I Learn C Programming from an Old Book?

    My dad gave me his old copy of "the c programming language" by Kernighan and Ritchie, but I was flicking through it and it comes across as quite old-fashioned and has a lot of random sh*t like pointer arithmetic, memory allocation etc. Being an idiot, and one who's pretty out of practice with...
  4. I

    Comp Sci Searching Array for an Element using Linear Search

    I write a Linear Search code,then ı decided ask to user "r" and "int arr".I mean,User decide their r and arr numbers.I tried scanf("%d",r); command but doesn't work This code my first code before the decide Ask user : #include <stdio.h> int search(int arr[], int n, int r) { int i; for...
  5. harborsparrow

    Good C programming introduction on Coursera, starts Feb 5

    If you're looking to get a serious but entertaining introduction to computer programming, I wholeheartedly recommend Anne, Andrew, and Genevieve's course, "Programming Fundamentals". https://www.coursera.org/learn/programming-fundamentals I know one of the instructors from my days at Penn, and...
  6. D

    Starting a C program with a command

    Homework Statement Analyze the code below and figure out what it outputs if it's started with this command: The correct solution is given so i can better understand the parts of the problem. Homework Equations 3. The Attempt at a Solution [/B] I had typed it out and tried to get the same...
  7. D

    What is the output of this C program with int pointers?

    Homework Statement I am supposed to analyze the code and find it's output without running it. Some things were unclear so i did run it and i have some things that puzzle me. Homework Equations 3. The Attempt at a Solution [/B] #include <stdio.h> #include <stdlib.h> #include <string.h> enum e...
  8. D

    Which code segment completes this C code?

    Homework Statement This is a question from the test i had today in which we had to look at certain C code segments and deduce which code part is missing in order for the program to do what we desire. Part b) was a short questionnaire to test our knowledge about c types and declarations. Part a)...
  9. D

    Assistance needed writing a C program

    Homework Statement My task is to write a program that reads from the .txt file into a list which contains two parts, the part of the text from the file and a pointer to the next element. Here are the specifications of the problem: When reading from the file you should separate the letters from...
  10. doktorwho

    How to dynamically allocate an array of strings

    I was supposed to write a program that has a while loop in which two people, person1 and person2 input a string. The program runs the loop until one of the people inputs "it's over". At that time the program should exit and print out the correspodance between these two people while they were in...
  11. doktorwho

    Help with pointers and strings in C

    Homework Statement I have to create a program that dynamically allocates a string and uses up no extra space (The string takes up as much space as it needs to),checks if entered string is 'please stop this', if it is then the prgogram exits and if it isn't then it continues, it makes a copy of...
  12. doktorwho

    Kernighan vs Deitel: Which C Programming Book Is Best for You?

    https://www.amazon.com/dp/0131103628/?tag=pfamazon01-20 https://www.amazon.com/dp/0133976890/?tag=pfamazon01-20 These two books are recommended by my school's C programming course and i can't decide which to buy. I have a big test in about a month in which i will have 2 hours to write 3...
  13. doktorwho

    Help writing a program (crossword puzzle)

    Homework Statement I am supposed to write a program in C that does the following: It creates a 2d array from your specifications and as inputs takes only letters 'a' to 'z', 'A' to 'Z' and '*' and nothing else. It should immediately exit if something else is inputed. This array represents a...
  14. doktorwho

    Question about limiting inputs in C

    I want to write a program that in the twodimensional array stores only capital and noncapital letters of the alphabet and the sign #. Everything else inputted cannot be stored in the array. How am i to do this in the easiest way? I can think of only checking for each input if it exists in some...
  15. V

    Why does not this Erdos-Renyi C code work?

    Homework Statement I need to write an Erdos-Renyi random graph, by using the adjacency matrix (or alternatively list) and calculate the fitness of the graph. Definition: G(n, p) is a random graph with n vertices where each possible edge has probability p of existing.Homework Equations The...
  16. doktorwho

    Review C Code: Find & Resolve Issues in Visual Studio & repl.it

    Hi, i wrote a code and annotated it but i have few problems with it. First it won't run on Visual Studio but it runs fine on repl.it online site which uses a C ide. Second, it seems wrong when i input 5 45 6 -4 8 3 It should print out 8 3 but for some reason it misses out on 3. Could you see...
  17. doktorwho

    Help w/ C Programming Homework - Create Array & Print All Inputs

    Homework Statement I am fairly new to C programming. I need to write a code that creates an array of max 300 numbers, ask the user to input the numbers and then print that array. Homework Equations 3. The Attempt at a Solution [/B] Here is my code #include <stdio.h> void main() { int...
  18. toforfiltum

    A C program to determine the most common birthday

    Homework Statement Write a program that opens a file of the users choice that contains a list of birthdays. Extract from this file two things: (1) the date with the most common birthday (all of them) and (2) the month with the most people born. We will not test for a tie in either of these...
  19. toforfiltum

    Simple C program involving arrays which cannot execute

    < Mentor Note -- thread moved to HH from the technical Computer forum, so no HH Template is shown > I have a homework problem which requires me to convert a word a user entered to Pig Latin by moving the first letter of the word to the end and adding an ay to it. For example, Tuesday becomes...
  20. doktorwho

    Learn C: Best Book for Beginner & Harvard Intro to Programming

    Hear me out on this. I am an absolute beginner to C, i know some Python and i just finihed a month course on Pascal (school currciulum) and we're starting C by the end of February. Even though I am a beginner I am a fast learner and i want a book that is escalating moderatly or even fast. Also...
  21. K

    How to involve system features in C programming?

    How to involve system functions like notifications, alert, and somewhat like that in C program?
  22. N

    C/C++ How to read a list of USB from C++ in ubuntu OS?

    I am trying to use C++ (eclipse in Ubuntu OS) to read USB connection. Usually, on the terminal window, I can use command "lsusb" to see the list. Now, I want to do the same way with C++. can anyone help? Thank you very much.
  23. pioneerboy

    Electronics Building an Alarm Clock with Basic C Programming Skills

    I'd like to build my own reliable alarm clock, but I don't have any knowledge in electronics and no fancy equipment, only some humble C programming experience. What do I need and what do I need to know to build one myself. Thanks very much.
  24. A

    Help in telling compiler to include header files for C

    For a program to use I have to compile some .c files which include #include''header.h'' statements and I have tried different commands to compile but it gives me errors like 'No such file or directory'. Here is start of my file named #include "einterp.h" while start of file looks like this...
  25. J

    MHB Compound Interest C programming problem

    Hello everyone, i hate that i can't figure this out and I'm just looking for good direction on how to figure out the last bit of my code. I'm first time user of C programming and haven't fully grasp the concepts and tools available to me so be patient if you offer any help. My task is to write a...
  26. Simon Clement

    C programming, where did I get it wrong please

    Edited by mentor to include image inline Hello Please I am practicing my simple basic C Programming using Notepad++ and Cygwin64 I have written tried running the codes in the picture below, it doesn't detect any error when I run it but when I try to 'withdraw some money less Tha the fBalance...
  27. U

    C data structures and algorithms - graph problem

    Homework Statement Given connected, directed and weighted (positive weights) graph. Find the shortest cyclic path for each vertex. Cycles have back edges and can also be self loops. 2. The attempt at a solution I need some clarifications for this problem related to implementation in C. After...
  28. U

    C - Degree of a directed unweighted graph

    Homework Statement Given the representation of directed unweighted graph: typedef struct { int n;//num. of vertices void *info[MAX];//information of vertices int am[MAX][MAX];//adjacency matrix }GRAPH; Write a function int minDegree(GRAPH*); and int maxDegree(GRAPH*); that return the...
  29. G

    C: Stack with binary search trees

    Homework Statement Create a linear stack with N binary search trees (data of a tree node is an integer). Read N trees, push them on the stack. Then, empty the stack and store trees in the new array and print the content of the stack. 2. The attempt at a solution The following code gives...
  30. G

    C: Printing unsigned char data type

    Homework Statement Given a matrix n x m with unsigned char data type entries (entries are of size 1 byte, so data type of an entry should be unsigned or signed char, not int or char *). Entries are read in hexadecimal format (0x00,0x11,0xFF,...). Matrix should be allocated dynamically. Print...
  31. F

    About only one function (C programming)

    I have learned that in c programming language at least one function is needed. And the function is given as: int main(){ //statements; return 0; } Then when I turned to the function page (in a web tutorial) I saw functions are declared by return type-function name and parameters. The...
  32. S

    Need help with accelerometer data processing

    Hi, am working on a vehicle tracking device, i am using LIS3Dh accelerometer to get the acceleration data. i am using TM4c1231e6pz controller. I need to implement a harsh breaking alert, I am having difficulty in finding out which direction the vehicle is moving since the axis are not aligned...
  33. G

    C program -- need an explanation

    Homework Statement I need help with the following problem in C programming language: Define a quiz and add two questions in it with given possible answers. Display the questions one by one and allow the user to choose between 1, 2 or 3 (numbers that represent serial numbers of possible...
  34. S

    Learn C Programming Language: Tips & Resources

    Hi all, I am looking to learn C by myself since it is a programming language that is used in my micro controllers class that i am going to take during the upcoming Spring semester at my university. I was wondering how i should go about doing this? I was thinking of using book The C Programming...
  35. Dave Ritche

    Looping problem in C programming

    I know about For loops but i don't know how to solve a problem like this: A program in which a user wants to print a number for specific number of times but this is not initialized i mean user inputs it after the program is compiled?
  36. G

    C: Store The Content Of Linked List Into BST

    Homework Statement The following program should create singly circular linked list which has n arbitrary stored positive integer numbers. Then, create BST which has all primes from the list, and store them in text file in descending order. Homework Equations Linked list Binary search tree File...
  37. SnakeDoc

    C Programming: Arrays and pointers

    Homework Statement So I created two arrays one called departure_time and the other arrival_time and populate each array as follows. I've tried both putting 8 and defining N as 8 int departure_times[N]={480, 538, 679, 767, 840, 945, 1140, 1305}; int arrival_times[N]={616, 712, 811, 900, 968...
  38. G

    How Can You Delete a Record from a Text File Using a Struct Field?

    Homework Statement How to delete specific record from a text file by some field from struct? Homework Equations -File handling -Searching algorithms The Attempt at a Solution I know that one of the searching algorithms is needed, but could someone explain how to delete found record from file?
  39. G

    Other C: Data structures and algorithms books of solved problems

    What books of solved problems (free in pdf) would you recommend for data structures and algorithms in C (linked lists, trees, sorting and searching algorithms, graphs, recursion, files)? Note: I am not looking for theoretical books, but books of solved problems. Thanks for replies.
  40. A

    C Programming - First assignment not sure how to approach

    Homework Statement Hi, I am currently in a C programming course and i have no background knowledge of programming whatsoever. The professor in my course isn't very good at explaining so I'm a bit lost here. (Please keep in mind, I am NOT asking anyone to do this for me. I would like to know a...
  41. G

    Dynamic allocation problem with linked lists

    Homework Statement I need to create data structure which contains three linked lists that are connected to one root node. Homework Equations -Data structuresThe Attempt at a Solution I can't find what is wrong with the following code: #include<stdio.h> #include<stdlib.h> typedef struct node {...
  42. G

    Dynamic allocation of adjacency matrix and traversing a list

    Homework Statement I have a binary tree. I need to print a path of a doubly circular linked list (0 and 1) after every user input. I have a code in which user inputs data about one person. For example, when user inputs 2 elements, the path should be 0->1. In my code, it won't print any path...
  43. S

    Python Good problems and exercises in C, Python, Ruby and Scala

    I have previously learned C and Python. I'm just starting out with Ruby and Scala. But I need to become more proficient in these languages, so could someone suggest good sources of problems/exercises in each of these languages sources could include websites, books, etc.
  44. C

    How Does the GET_UINT32 Macro Convert Input into Hexadecimal Format?

    Homework Statement this is in my function GET_UINT32( X, input, 0 ); this is a macro #define GET_UINT32(n,b,i) \ { \ (n) = ( (uint32) (b)[(i) ] << 24 ) \ | ( (uint32) (b)[(i) + 1] << 16 ) \ | ( (uint32) (b)[(i) + 2] << 8 ) \ | ( (uint32) (b)[(i) + 3] ); \ } 3435973836=0xcccccccc when inputted...
  45. N

    Could someone give me a basic lesson/project to do in C

    I know there are many resources online for this but I'd to learn from someone on here. Could you provide me a lesson/project to do and finish in C language for beginners. I can get the software needed to compile and such and will post an image when I am done or provide whatever proof of...
  46. G

    Trick-or-Treat (Halloween C programming)

    Homework Statement Trick Or Treat Halloween is round the corner and it's time for trick-or-treating. You reside at the top left corner of a n-by-n town map and heading to the halloween party located at the bottom right corner. While on your trip, you decide to visit a minimal number of houses...
  47. G

    Winning Lines for Tic-Tac-Toe (C programming)

    The Question Winning Lines Tic-tac-toe is a game played by two players o and x. A player wins when he/she succeeds in placing three respective marks in a horizontal, vertical or diagonal row. Given a 3-by-3 tic-tac-toe board, a winning line is a line (row, column or diagonal) that is not...
  48. G

    Implementing strcat without string.h in C

    Hi everyone. This is similar to my strcpy question previously. I tried to code but when I ran the code, a segmentation fault appears. I think this has something to do with my loop for the array but I have problems resolving it. May I have some help please? Thank you. My codes and the original...
  49. G

    Implementing strcpy without <string.h>

    Hi everyone. I ran into a problem while trying to code the string function, strcpy, without the use of <string.h>. The function, strcpy, which I have to make myself is exactly the same as the strcpy in <string.h>.The question in my homework is: Implement the my_strcpy(s1,s2) function that...
  50. D

    Can Anyone Help with Simple C Programming in Ax=B Homework?

    Homework Statement #include <stdio.h> #include <stdlib.h> #include <math.h> int main() { int i,j,k,n; float A[3][3]={{3,0,6},{4,1,3},{6,3,0}}; float U1[3][4]={{3,0,6,0},{4,1,3,0},{6,3,0,0}}; float U2[3][4]={{3,0,6,0},{4,1,3,0},{6,3,0,0}}; float...
Back
Top