15,551 Topics
| |
So, I am learning C and have this newby problem. This is my snippet: [CODE] #include <stdio.h> main() { char x; unsigned y; x=0xFF; y=0xFFFF; printf("Size of char: %d-bits\n", sizeof(char)*4); printf("Size of int: %d-bits\n", sizeof(int)*4); printf("\n0x%X in decimal: %d\n", x, x); printf("\n0x%X in decimal: %d\n", y, y); return 0; } … | |
I'm having trouble figuring out what exactly I'm missing in this Byte reversal method. For example is should take 0x01020304 and flip the bits to 0x04030201. I've attached my output giving the errors and here is my code: [CODE]/* * reverseBytes - reverse the bytes of x * Example: reverseBytes(0x01020304) … | |
I am having trouble understanding how to implement these problems in C using bit operators. I understand the basic logic gates and when I work them out on paper they work just not code wise. Any insight/help would be great. [code=c] /* * bitXor - x^y using only ~ and … | |
I want the following. Write a program that implements the FIFO and LRU page-replacement algorithms ( Virtual Memory) 1) Read the size of reference string from keyboard 2) Generate a random page-reference string where page numbers range from 0 to 9 3) Create a input file with generated reference string … | |
Folks, here is an implementation of memset(), however I have been told that there is one logical mistake in the code. Could you help me find it. I feel that a double pointer for the target string should be passed to this function, which will be like passing the address … | |
Hello. I'm not getting the desired output for my program. The problem is specifically in the file. I can get it to save and load but when I try displaying it, its gonna have a General Protection Exception error. Here's my code. Please help [code=c] #include<stdio.h> #include<conio.h> #include<string.h> #include<stdlib.h> #define … | |
Hello, i have written the code for checking a given tree is strict binary or not. i tried the following code but i am not getting the correct result. and i unable to understand how to check. int strict ( BST_t *p ){ if( p == NULL ) return 1; … | |
please help im really stuck in my sorting you see i need to make a program that asks the user 10 names of people then the array of names gets pass to another function where it is sorted in ascending or descending depending on what the user wants. that function … | |
Hey there, How do I installer gtk+ under windows and compile using the gcc compiler through command line. (not using IDE, just notepad++). I've been looking at the gtk+ site but don't have clue as to where to start and how to install libraries. What do I download and how … | |
#include "include.h" #include "extern.h" int ExternalIP(SOCKET Sock, char *szChannel) { DWORD dwRet = 0; HANDLE hHandle; char szIP[16] = {0}; char szTempPath[MAX_PATH] = {0}; char szTempFile[MAX_PATH] = {0}; char szSendBuffer[512] = {0}; if (!szChannel) return false; GetTempPath(sizeof(szTempPath) - 1, szTempPath); GetTempFileName(szTempPath, "Temp", 0, szTempFile); // if (URLDownloadToFile(NULL, "http://www.whatismyip.org", szTempFile, 0, … | |
I have a data file that, if I was using C++, I would use the getline function to read its data into the proper variables. However, the getline functions that C++ allows appear to not be available to me in C. I want to be able to specify a stream, … | |
Hello! I am taking a scientific computing class, where we are doing some programming in C, and right now our assignment is to add commentary to an existing program explaining what every line does (starting at the line that says Start here!). As you can see in the code below, … | |
Hello, I am making a program to make a directory in a users Library folder then create a file in it. Whenever I try to make the directory I get an error and if I continue with the program i get a segmentation fault error Here is the source Code … | |
| realy desperate here.. :'( my prog is getting data about problems (computer/electricity..ect (not real C problems)) from txt file..and every line in file has a different problem..so I made one PROBLEM problem; (object) and in my getProbDetails() function I'm getting the first line..reallocing to add one more object (creating array … |
Hi, guys, i need some help, as i can't find a mistake in my code for some hours. I'm expiriencing a problem in function makeCodes, which should make huffman codes for my symbols. In my head this works just fine, recursively making codes, but my Visual Studio crashes on the … | |
Hi, is there anyone who could help me to writing my program output to txtfile. i mean read file and write the output to txtfile for example: FILE *fp fp = fopen("test.txt", "r"); if(fp = NULL){ printf....... } and what should i do to writing the output to txtfile thanks … | |
could anyone help me with this code? the algo is alroght when tested manually. guess there is some problem with the declaration part which gives huge values(garbage ) thank you[code]#include<iostream.h> #include<stdio.h> #include<stdlib.h> #include<math.h> #include<conio.h> #define m 10 // m samples #define n 5 // n variables #define dim 5 //whatever … | |
hello.. Can anyone help me? I have to use c programming to calculate the single-error-correction double-error-detection.. I have no idea on how to start to write the program.. I only know that hamming code is used to correct single bit error and parity bit is the error detecting code.. This … | |
I am a C++ and Java programmer and I just have a couple simple syntax questions that I can't find a clear answer to. Yes I tried Google. [B]Question 1: [/B]I found the following code on another forum. [CODE]typedef struct List { char* Name; char* Address; BOOL is_present }List_info; List_info … | |
hello i was reading today some stuff abt bitfield but here in this program I understand most of it but there unnamed fields inside the structure book says its stuff for allgiment or something like that i dont rlly get what does it do [code] /* fields.c -- define and … | |
hhmm.. i need to get the pattern of this particular output on one digit odd number.. could anyone please teach me? ^^ if the number is 9: then the pattern is: *000*000* 0*00*00*0 00*0*0*00 000***000 yeah, the three asterisks get nearer as the line gets down... how can i formulate … | |
hello~ Write a program that will display a pattern depending on n. Assume n as a one digit odd number. Example: if n=9, display *000*000* 0*00*00*0 00*0*0*00 000***000 how will i start doing this type of problem? ^^ | |
I'm a noob when it comes to C programming. I wrote a simple program that runs an infinite for loop. But inside that loop I wanted to create another loop to stop the user three times after entering incorrect passwords. I tested from different angles it seems like the infinite … | |
have this code and when i run it, i get the output on the screen, what i would like to do is that i can see the output on the screen and send it to an xls of cvs file. is there anyone who could chage the code and let … | |
I m trying to find idea to change like from 1 to one and 2 to two and 3 three from 1 to 999 i m had an idea to do like a string with information etc ? but i want better idea so i dunno how to do it … | |
p1a.c: In function `main': p1a.c:20: parse error before `char' p1a.c:46: parse error before `char' p1a.c:47: `result' undeclared (first use in this function) p1a.c:47: (Each undeclared identifier is reported only once p1a.c:47: for each function it appears in.) p1a.c:47: `basechars' undeclared (first use in this function) | |
You are required to write a C program to carry out a strict-left-to-right evaluation of an arithmetic expression consisting of integer constants and the operators +, −, *, and /. Here, the operator / denotes integer division; that is, the remainder is discarded. In a strict-left-to-right evaluation, there is no … | |
Hi, I need to use the borland c++ complier for making my college project. I use only linux and I am unable find the compiler. Any help will be much appreciated as I am stuck. cheers, Vishal p.s- Gcc and other compilers are not allowed for the project . | |
I am writing a circular/ring buffer of a specified size. I am struggling with figuring out if my code is working. It compiles and runs with no problem, but I try testing it with print statements and I get confused. Can anyone give me some advice for how to test … | |
|
The End.