justin-lathrop / c Goto Github PK
View Code? Open in Web Editor NEWC Programming Projects
C Programming Projects
Write a program to find the HCF and LCM of the given number without using the multiplication and division.
int address=0124;
printf("%d",address);
Output=124
Why it ain't output 0 with all of those number?
hello man can you help me in C ?
i now how to extract ANCII chars and concaternate them..
what i need to know its how can i execute that ancii string after concaternation ..
example:
1º i what to extract the string whoami from ancii chart
2º concaternate the chars to build whoami command
3º and execute the string concaternated ..
this code does allmost everything..
it extracts the chars, concaternate them ...
but it only prints the string ..
but i dont what to print ..i want to execute ..
#include <stdio.h>
#include <string.h>
int main(void)
{
/* variable declarations */
char a = 119; /* ancii character w */
char b = 104; /* ancii character h */
char c = 111; /* ancii character o */
char d = 97; /* ancii character a */
char e = 109; /* ancii character m */
char f = 105; /* ancii character i */
/* concaternate and transform decimal values to ancii chars using putchar */
//char command = putchar('a');putchar('b');putchar('c');putchar('d');putchar('e');putchar('f');
/* execute command using system() */
int system(char command);
system(command);
}
#include<stdio.h>
#include<conio.h>
int main()
{
printf(" enter your name");
return 0;
}
Develop a discussion forum for VTU students.
It should have functionalitiess such as,
Login from Stackoverflow or Quora
support for profile pictures.
An user can start a discussion, comment on others discussion,
User submitted question can be shared on quora and other popular platforms.
in your queue.c
your pop function is not O(1) complexity of time.
your vpn code is too hard for me .lol
#include <stdio.h>
/*
* @author jelathro
* @Date 2/19/13
*
* Provide various examples of pointers
* and how pointers work.
*/
int main(void){
// Basic pointers and Basic addresses
int *basic_pointer;
int basic_value;
// Give value a literal value
basic_value = 'A';
// Assign pointer to address
// of literal value in value
basic_pointer = &basic_value;
printf("pointer is at address %p\n", &basic_pointer);
printf("value at address of pointer is %c\n\n", *basic_pointer);
// More advanced use of pointers
// Array's are just fancy pointers
char array[5] = {'a', 'A', 'b', 'z', 'M'};
char *same_array = array;
char **fancy_same_array = &same_array;
printf("array[3] = %c, addr = %p\n", array[3], &array[3]);
printf("same_array[3] = %c, addr = %p\n", same_array[3], &same_array[3]);
printf("**fancy_same_array[3] = %c, addr = %p\n", (*fancy_same_array)[3], &(*fancy_same_array)[3]);
// char arrays are also just a "string"
// of characters.
printf("array string %s, addr = %p\n", array, &array);
printf("same array string %s, addr = %p\n", same_array, &same_array);
printf("fancy array string %s, addr = %p\n\n", (*fancy_same_array), &(*fancy_same_array));
// Arrays of pointers
char *ptr_array[2];
char *ptr1 = NULL, *ptr2 = NULL;
char char_elements[2] = {'H', 'i'};
ptr1 = &char_elements[1];
ptr2 = char_elements;
ptr_array[0] = ptr2;
ptr_array[1] = ptr1;
printf("**ptr_array = %c\n", **ptr_array);
printf("addr at **ptr_array = %p\n", &(**ptr_array));
printf("addr at **ptr_array[0] = %p\n\n", &(ptr_array[0]));
printf("ptr_array[1] = %c\n", *ptr_array[1]);
printf("addr at *ptr_array[0] = %p\n", &(**ptr_array));
printf("addr at *ptr_array[0] = %p\n", &(**ptr_array));
printf("addr at *ptr_array[1] = %p\n", &(*ptr_array[1]));
return 0;
}
Hi Man
I try to figure out the difference between the "for" and "while", the following code works fine with for loop but it does not work with while loop, what is the problem?
#include <stdio.h>
#define MAXLINE 1000
int getlines(char linestr[], int limitation);
void copy(char to[], char from[]);
main()
{
int len; /* current line length /
int max; / maximum length seen so far /
char line[MAXLINE]; / current input line /
char longest[MAXLINE]; / longest line saved here */
max = 0;
while( (len = getlines(line, MAXLINE)) > 0)
{
if(len > max)
{
max = len;
copy(longest, line);
}
}
if (max> 0) /* there was a line */
{
printf("\n%s", longest);
}
return 0;
}
int getlines(char linestr[], int limitation)
{
int i, c;
i = 0;
while((c=getchar()) != EOF && i < limitation - 1)
{
if(c == '\n')
{
linestr[i] = c;
++i;
linestr[i] = '\0';
return i;
}
else
{
linestr[i] = c;
i++;
}
}
}
/*
int getlines(char linestr[], int limitation)
{
int i;
int c;
for(i=0; i < limitation - 1 && (c=getchar()) != EOF && c !='\n'; ++i)
{
linestr[i] = c;
}
if (c == '\n')
{
linestr[i] = c;
++i;
}
linestr[i] = '\0';
return i;
}
*/
void copy(char to[], char from[])
{
int i;
for(i=0; (to[i] = from[i]) != '\0'; i++)
;
}
Best Regards,
Ming
In C it is a bad idea to type cast the result of malloc
explicitly.
Here is link to the the issue on stackoverflow :
http://stackoverflow.com/questions/605845/do-i-cast-the-result-of-malloc
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.