Hi everyone,
I was wondering if it's possible to redefine ! to mean 'call my factorial function on the preceding value' and, because ! usually means 'not', redefine ~ to mean 'not'. I won't need...
Type: Posts; User: C-UL8R
Hi everyone,
I was wondering if it's possible to redefine ! to mean 'call my factorial function on the preceding value' and, because ! usually means 'not', redefine ~ to mean 'not'. I won't need...
I don't really know much about memory but I declared the pointer "filename" inside the function with "String filename;". I also tried declaring it like this: "char filename[50];" but that didn't fix...
I edited in regards to "String". I am trying to read it and print a character from it to main.c, not write to it.
Hi everyone,
This is my first real attempt at file i/o stuff in C. The user should be able to choose whether to import the provided file or their own file, and I was able to open the provided...
Hi everyone, this is a small snippet of code from my school project:
#include <stdio.h>
int main(void) {
char menu[5][35] = {"Please select one of the following:", "A. Define Random...
A little late, but you seem to be defining quite a few unnecessary functions. The code in headerMessage() can be cut-and-pasted directly into the nearly empty main() function for sure. I really don't...
Hi everyone,
I recently discovered the comma operator in C and it has certainly been useful in my projects. However, I worry that evaluating many instructions in one line can quickly uglify the...
Hi everyone,
Why does this line of code produce an infinite loop upon receiving invalid input, and how do I fix it?
for (int i = 0; !i; i = scanf("%lf", &myDouble)) puts("Please enter a...
Thank you laserlight! Very informative. My professor does indeed use a type prefix in the names of all functions and variables (e.g. int intA; char charC). He mentioned that it was helpful in earlier...
I apologize if answering your condescending, rhetorical questions upset you. You posted a fairly useless code snippet that seemed only to be there as a 'Hey look at me I can do what you did in 21...
Your code is much shorter, but doesn't handle invalid input, does not define boundaries and only allows input once. The fn prefix on function names was at the suggestion of my professor. goAhead...
Hi everyone,
I'm writing a program that should take in a number, e.g. 12345, and convert it to what my professor calls engineering notation, e.g. 12k. My code is probably longer than it needs to...
Hi, laserlight! Unfortunately, my programming background is very surface level, and until now I've never really cared about what is good practice and what is not. Now that I'm starting a CS degree,...
Actually, I spoke too soon. I just had to store the result of calling the function back into the appropriate counter variable. Thank you!
Hi Salem,
Returning the counter (and changing void to int accordingly) did not fix the problem. I'm not sure what I'm supposed to do with the returned value anyway.
Hi all,
I've come a little farther in my C studies since my last post, and I decided to try my hand at building a custom function. The code is compiling, but the counters no longer count past 1. I...
No context? Nothing? You may get better advice if you add some details about what specifically you need help with and what you are attempting to create.
Perhaps I'm mistaken, but it looks to me like goto is indeed an ASM instruction. I was always told to avoid goto in C because it was too "Assembly-ish".
Hi everyone,
I'm still new to C, coming from a Python background, and I was wondering if you could suggest any ways to improve/shorten my code. It's for a first-year university assignment, but...