language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /****************************************************/
integer *
integer_sadd(integer * d1, integer * d2)
{
int k, i = d2->len_of_integer;
INTEGER_FULL_TYPE sum = 0;
if (d1->vec_of_integer[d1->len_of_integer - 1] > (INTEGER_MAXNUM >> 1))
{
d1->len_of_integer++;
d1->vec_of_integer = realloc(d1->vec_of_inte... |
C | /**********************************************************************
Module: g_adt.c
Author: Scott Wang
Date: 2006 Oct 5
Purpose: A data struct for Omega game
**********************************************************************/
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <pthread... |
C | /* Employee_info_list
REQ:
1. Write a struct that has a member that is the name of a business department:
HR, Sales, Research, Software, and Executive (use enums for the 4 departments).
2. A second member that is an annual salary as an int.
3. A third member that is a social security number(unsigned).
4.... |
C | /* Fetch the desired region of xe3-formatted catalog stars.
*
* xe3 is a very compact format storing just ra/dec/mag/class for each star.
* Each star occupies 3 bytes and stores RA to a precision of +/- .38 arcsecs,
* Dec to .44 arcsec, Mag in the range 10..20 to .16 and 1 class bit set to 0
* for star or 1 for ot... |
C | #version 440 core
// this simple vertex program passes position through and colours vertexes based on position.
layout (location = 0) in vec4 position;
out vec4 frag_color;
void main(void)
{
gl_Position = position;
frag_color = vec4(gl_Position.x, gl_Position.y, 0.0, 1.0);
} |
C | //=============================================================================
//
// ͏ [input.h]
// Author :
//
//=============================================================================
#ifndef _INPUT_H_
#define _INPUT_H_
//*****************************************************************************
// }N`
/... |
C | #include <stdio.h>
int main(int argc, const char *argv[])
{
FILE *fp = NULL;
char buf[10] = {0};
//fgets(buf,10,stdin);
//printf("%s\n",buf);
fp = fopen("test","r");
if(fp == NULL)
{
printf("fail to fopen\n");
return -1;
}
fgets(buf,10,fp);
printf("%s\n",buf);
fgets(buf,10,fp);
printf("%s\n",buf);
... |
C | #include "../munit/munit.h"
#include "event_processor.h"
classes_stack *top;
classes_list *head;
classes_list *tail;
static void*
clear_list_setup(const MunitParameter params[], void* user_data) {
head = malloc(sizeof(classes_list));
tail = malloc(sizeof(classes_list));
head->next = tail;
}
static void*
clear_... |
C | #include <webassembly.h>
#include <stdlib.h>
#include "headers/game.h"
/** Un "buffer" da 5 interi per rappresentare una pedina [y, x, tower_0, tower_1, tower_2] */
int buffered_piece[5];
/** Un "buffer" da 8 interi per rappresentare le 4 mosse possibili di una pedina
* [y0, x0, y1, x1, y2, x2, y3, x3]*/
int buffered... |
C | #include "head.h"
int goout = 0;
int shmid; //共享内存id
sensor_data *shmaddr; //指向共享内存区域指针(修改为结构体指针)
key_t key;
int msgid;
MSG msg;
pthread_t mythread;
int *thread_arg;
struct sockaddr_in ser_addr ;
int count; //接收数据个数
int sockfd ; ... |
C | // Copy input to output
// COMP1521 18s1
// MINGFANG JIAO Z5142125
#include <stdlib.h>
#include <stdio.h>
void copy(FILE *, FILE *);
int main(int argc, char *argv[]){
if (argc == 1) {
copy(stdin, stdout);
} else {
// for each command line argument
int i;
for (i = 0; i < argc; i++... |
C | #include <stdbool.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <getopt.h>
#include "DES.h"
//////////////////////////////////////////////////////
// GLOBAL VARIABLES //
////////////////////////////////////////////////////
static FILE * output = NULL;
//////... |
C | /*
* pwm_if.h
*
* Created on: Dec 21, 2017
* Author: a0225962
*/
#ifndef INTERFACES_PWM_IF_H_
#define INTERFACES_PWM_IF_H_
//
// The PWM works based on the following settings:
// Timer reload interval -> determines the time period of one cycle
// Timer match value -> determines the duty cycle
// ... |
C | #include <stdio.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <pthread.h>
#include <stdlib.h>
//fibonacci
void *fib(void *argv){
int n = *(int *)argv;
if(n>=0&&n<=10000){
int arr[10000]={0};
arr[0]=0;
arr[1]=1;
int i;
for(i=2;i<=n;i++){
arr[i]=arr[i-1]+arr[i-2];
}
for(... |
C | /**
* @file testebbchar.c
* @author Derek Molloy
* @date 7 April 2015
* @version 0.1
* @brief A Linux user space program that communicates with the ebbchar.c LKM. It passes a
* string to the LKM and reads the response from the LKM. For this example to work the device
* must be called /dev/ebbchar.
* @see h... |
C | /* version 88/06/02:Mirella 5.0 */
/********************* MIRAMEBA.C ****************************************/
/* This module is essentially the numerical recipes amoeba program, modified
for Mirella/tools support */
#ifdef VMS
#include mirella
#else
#include "mirella.h"
#end... |
C | FLOAT identity(FLOAT x) {
return x;
}
FLOAT dIdentity(FLOAT y) {
return 1;
}
FLOAT sigmoid(FLOAT x) {
return 1 / (1 + exp(-x));
}
FLOAT dSigmoid(FLOAT y) {
return y * (1 - y);
}
//using fast tanh of math.h instead
/*
FLOAT tanh(FLOAT x) {
return (2 * sigmoid(2 * x) - 1);
}
*/
FLOA... |
C | #include <stdlib.h>
#include <signal.h>
#include <string.h>
int main()
{
int i;
char *ptr;
//for(i=0; i < 32 * 1024; i +=16)
for(i=0; i < 8192; i += 1024 )
{
ptr = (char *) malloc( i );
memset(ptr, 0xFF, i );
fprintf(stderr,"%p ", ptr );
}
ptr[-1] = '0';
//free(ptr);
//free(pt... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: ... |
C | #include<stdio.h>
#include<string.h>
#include<limits.h>
#define f(i,x,y) for(int i=x;i<y;i++)
#define inf 9999
int g[1000][1000], n, seen[1000];
void fw()
{
int dist[n][n];
f(i,0,n) f(j,0,n) dist[i][j] = g[i][j];
f(k,0,n)
f(i,0,n)
f(j,0,n)
if(dist[i][k] + dist[k][j] ... |
C | /*
MIT License
Copyright (c) 2019 Elliot K Bewey
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish,... |
C | #include <stdio.h>
#include <stdlib.h>
#include "mem.h"
void* alloc(size_t size){
void *a = mem_alloc(size);
printf("Allocated %ld bytes at : %p\n",size,a);
return a;
}
void free_alloc(void *a){
mem_free(a);
printf("Freed %p\n",a);
}
int main(int argc,char **argv){
mem_init();
void *a = alloc(455), *b... |
C | #include <avr/io.h>
#include <stdlib.h>
#include <string.h>
#include <avr/pgmspace.h>
#include "F_CPU.h"
#include "util/delay.h"
#include "oled.h"
#include "joystick.h"
#include "menu.h"
#include "menu_names.h"
#include "sram.h"
Node newNode(MENU menu){
// Assign struct to Node
Node node;
node.menu = menu;
/... |
C | /* ECP: FILEname=fig9_22.c */
#include <stdio.h>
#include "complex.h"
main( void )
{
Complex A, B;
A = InitComplex( 2.0, 4.0 );
B = InitComplex( 0.0, 0.0 );
AddComplex( A, A, B );
printf( "B is: " ); PrintComplex( B ); printf( "\n" );
return 0;
}
|
C | #include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#define MAX_BUF 128
main() {
int n, fd[2];
pid_t pid;
char buf[MAX_BUF];
if (pipe(fd) < 0) {
perror("pipe");
exit(1);
}
if ((pid = fork()) < 0) {
perror("fork");
exit(1);
}
else if (pid == 0) {
printf("Child is using %d for writing.\n... |
C | #include "ft_printf.h"
char *ajout_zero_o(char *chaine)
{
int lon;
char *nouvelle;
lon = ft_strlen(chaine);
if (lon == 1 && chaine[0] == '0')
return (chaine);
if (!(nouvelle = ft_strnew(lon + 1)))
return (chaine);
nouvelle[0] = '0';
nouvelle = ft_strncat(nouvelle, chaine, lon);
free(chaine);
return (no... |
C | #include <stdio.h>
/**
* main - program start
* Description: generate a lowercase alphabet string using putchar
* Return: 0
*/
int main(void)
{
char letter = 'a';
char z = 'z';
while (letter <= z)
{
putchar (letter);
letter++;
}
putchar ('\n');
return (0);
}
|
C | //L8_z2
//while((smietnik=getchar())!='\n');
#include <stdio.h>
#include <string.h>
#define N 10
#define M 10000
void wyswietl(char *, char *);
void generuj_dane(double (*)[N]);
void zapisz_do_pliku_bin(char *, double (*)[N]);
void zapisz_do_pliku_text(char *, double (*)[N]);
int main(int argc, char **argv)
{
char na... |
C | #pragma warning(disable:4996)
/*two_func.c -- 一个文件中包含两个函数*/
#include<stdio.h>
void butler(void);/* ANSI/ISO C 函数原型*/
int main()
{
printf("I will summon the butler function.\n");
butler();
printf("Yes.Bring me some tea and writeable DVDs.\n");
return 0;
}
void butler(void)/* 函数定义开始 */
{
printf("You ... |
C | void pointers()
{
//normal integer variable
int i = 1234;
//* means pointer variable
//0 is a special memory address that is always invalid, alwasy initialize this
int * p = 0;
//get the pointer of something & address of indicator
p = &i;
//get the value back out of the pointer, the value that is in the mem... |
C | #include <MLV/MLV_all.h>
#define RED 1
#define BLUE 2
int main() {
int c = RED;
int x,y;
int clique = 0;
MLV_create_window("rectangle","shapes",1080,720);
MLV_draw_filled_rectangle(5,5,1070,710, MLV_COLOR_RED);
MLV_actualise_window();
MLV_wait_mouse(&x,&y);
while (clique != 1) {
if (c == RED) ... |
C | #ifndef __ENEMIES_H__
#define __ENEMIES_H__
#include "gf2d_entity.h"
typedef enum {
ET_RED,
ET_BLUE,
ET_GREEN,
ET_YELLOW,
ET_SUPER
}EnemyTypes;
/**
* @brief spawn a new red flower
* @param parent the parent to spawnt he flower on, null is at the start of the level's next path
* @return the spawned entity
*/
Ent... |
C |
typedef struct list {
char *value;
int key;
struct list *next;
} *List;
List initList(int key, const char *value);
int containsValue(List l, const char *cuvant);
List removeFromBucket(List l, const char *value);
List addLast(List l, int key, const char *value);
List freeBucket(List l);
|
C | // Pi (not in math.h)
#define M_PI 3.14159265358979323846
#include <math.h>
double missingAngle(double h, double a, double o) {
if (o == 0) {
return round(acos(a/h)*180/M_PI );
}
if (h == 0) {
return round(atan(o/a)*180/M_PI );
}
if (a == 0) {
return round(asin(o/h)*180/M_PI );
}
}
|
C | #include <libmtp.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "mtp_helpers.h"
char *toIDStr(MTPDeviceIdInfo info)
{
char buffer[1024];
sprintf(buffer, "%d:%d:%s", info.vendor_id, info.product_id, info.serial);
unsigned int idLen = strlen(buffer);
char *idStr = malloc((idLen + ... |
C | #pragma once
#include "glm.hpp"
struct Controller
{
float resource1;
float resource2;
int normalunitlevel;
int rangeunitlevel;
int tankunitlevel;
float normalunitcost;
float rangeunitcost;
float tankunitcost;
float normalunitcost2;
float rangeunitcost2;
float tankunitcost2;
float towercost;
float wallc... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/time.h>
#include<stdio.h>
unsigned int parse_memory_size(char *m);
struct mem_block
{
char buffer[1048576];
};
int main (int argc, char *argv[])
{
printf("PID: %d\n", (int) getpid());
if (argc < 2)
{
printf ("please sp... |
C | #include <stdlib.h>
#include "ft_stock_str.h"
#include <unistd.h>
void ft_putchar(char a)
{
write(1, &a, 1);
}
void ft_print(char str[])
{
int a;
a = 0;
while (str[a] != '\0')
{
ft_putchar(str[a]);
a++;
}
}
void ft_putnbr(int size)
{
long int i;
i = size;
if (i > 9)
{
ft_putnbr(i / 10);
ft_putnbr... |
C | #include "motor.h"
#include "distanceSensor.h"
#include "indicators.h"
#define WALL_FLLOW_DEBUG false
// Full speed PID Values
double WALL_FULL_SPEED_Kp = 3.7;
double WALL_FULL_SPEED_Kd = 0;
#define WALL_FULL_SPEED_Ki 0
// Half Speed PID values
#define WALL_HALF_SPEED_Kp 0
#define WALL_HALF_SPEED_Kd 0
#define WAL... |
C | /******************************************************************************
Online C Compiler.
Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.
***********************************************... |
C | #ifndef LUA_SCRIPT_H
#define LUA_SCRIPT_H
/*=========================================================
DECLARATIONS
=========================================================*/
#include "lua/lua_script_.h"
/*=========================================================
INCLUDES
============================================... |
C | #include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
char closing(char c) {
switch (c) {
case '(':
return ')';
case '[':
return ']';
case '<':
return '>';
case '{':
return '}';
}
return EOF;
}
char opening(char c) {
switch (c) {
case ')':
return '(';
... |
C | #include "audioCl.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ao/ao.h>
#include <math.h>
//Affiche la liste des musiques au clients
void liste_musiques(char *son[],int taille)
{
int i;
printf("\n******** Voici la liste de musiques disponible ******** \n");
for(i=0;i<taille;i++)
{
p... |
C | #include <stdio.h>
int main(void)
{
int values[16], row[4], column[4], diagsum[2], i;
for(i=0; i<4; i++)
{
row[i] = 0;
column[i] = 0;
if (i < 2)
diagsum[i] = 0;
}
printf("Enter the numbers from 1 to 16 in any order: ");
for (i = 0; i < 16; i++)
... |
C | //************************************************************************************
//Estimated time spent ~ 7 hours
//File: fraction.c
//Assignment: Homework 4
//Author: Mahesh Gautam
//Date: Spring 2016
//Description: This program takes in a input file containing fractions via command line
//argument, sorts them, ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <time.h>
#define MAXBUFSIZE 4096
int main (int argc, char** argv) {
int i;
int server_socket;
int client_s... |
C | #if defined(_WIN32)
#include <windows.h>
#else
#include <unistd.h>
#endif
/* sleeps for 4n seconds, where n is the argument to the program */
int main(int argc, char** argv)
{
int time;
if (argc > 1) {
time = 4 * atoi(argv[1]);
}
#if defined(_WIN32)
Sleep(time * 1000);
#else
sleep(time);
#endif
return ... |
C | /* $Header: /home/student1/dos_cvrt/RCS/unix2dos.c,v 1.2 1998/12/06 21:34:06 student1 Exp $
* Basil Fawlty $Date: 1998/12/06 21:34:06 $
*
* UNIX to DOS text format conversion.
*
* $Log: unix2dos.c,v $
* Revision 1.2 1998/12/06 21:34:06 student1
* Added error checking.
*
* Revision 1.1 1998/11/2... |
C | #pragma once
#include <stdint.h>
#include <stddef.h>
struct terminal {
size_t width;
size_t height;
size_t row;
size_t col;
size_t tab_size;
uint8_t color;
uint16_t* buffer;
};
void term_init(struct terminal* term, size_t width, size_t height, void* buffer);
void term_putchar_at(struct terminal* term, char c,... |
C | #include <stdio.h>
#include <stdbool.h>
struct TreeNode {
int val;
struct TreeNode *left;
struct TreeNode *right;
};
typedef struct TreeNode node;
#define BAD_HEIGHT -100
int max( int left, int right ) {
if ( left > right ) { return left; }
return right;
}
int getHeightIfBalanced(struct TreeNode* root) {
in... |
C | #include<stdio.h>
int main(int argc, char const *argv[])
{
// char a[][10]={"ss"};
int i;
for(i=0;i<argc;i++)
{
printf("%d:%s\n",i,argv[i] );//argv存储了命令行后跟随的命令,argv[0]固定为路径
}
return 0;
}
/*
#include<stdio.h>
#include<string.h>
int main(int argc, char *argv[])
{
// char a[][10]={"ss"};
int i;
char *a;
for... |
C | #include<stdio.h>
void main(){
int a,i,b,arr[8]={0,0,0,0,0,0,0,0};
printf("enter the number which is to be converted from decimal to hexadecimal\n\n");
printf("please enter non negative and integer values only\n\n");
scanf("%d",&a);
if(a)
if(a<0){
printf("sorry.......it works only for non negative decimal values... |
C | /*
* main.c
*
* Created on: Nov 10, 2013
* Author: Nathan Lane
* Class: CSIS-2430
*
* Trip Through Germany.
*/
#include "sqlite3.h"
#include <stdio.h>
#include <stdlib.h>
int main()
{
int retval;
sqlite3_stmt * stmt;
sqlite3 * handle;
char * val;
int col;
int cols;
retval = sqlite... |
C | /*
* @Author: 王教鼎
* @Date: 2021/5/20 9:40 下午
* @Description: 第3题
*/
#include <stdio.h>
int main(void)
{
const int NUMBER_OF_DAYS_IN_A_YEAR = 365;
int age = 27;
int days = age * NUMBER_OF_DAYS_IN_A_YEAR;
printf("你的年龄:%d岁,\n", age);
printf("你的年龄转换成天数:%d天\n", days);
return 0;
}
|
C | /* See LICENSE file for copyright and license details. */
#include <stdio.h>
#include <unistd.h>
#include "util.h"
static void
usage(void)
{
eprintf("usage: %s\n", argv0);
}
int
main(int argc, char *argv[])
{
char *login;
argv0 = argv[0], argc--, argv++;
if (argc)
usage();
if ((login =... |
C | // .* matches ab because .* == .. = ab
bool isMatch(const char *s, const char *p) {
if(*p =='\0') return *s =='\0';
if(*(p+1) == '*'){
//* 的作用,P能匹配:匹配0个,进入下一阶段子集;匹配1个,进入子集;匹配2个。。。。
//匹配不上, 直接进入下一阶段匹配
while((*p == '.' && *s != '\0') || *s == *p){... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#define BUF_SIZE 30
void error_handling(char *message);
int main(int argc, char *argv[])
{
int server_socket, client_socket;
FILE *fp;
char buf[BUF_SIZE];
int read_count;
struct sockadd... |
C | #include <netdb.h>
#include <netinet/in.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#define MYPORT 2220
#define BUF_LEN 1000
#define IP "127.0.0.1"
int main(){
int sock, len;
struct sockaddr_in serv;
socklen_t addlen = sizeof(serv);
char buf[BUF_LEN];
s... |
C | #include<stdlib.h>
#include<stdio.h>
#include<string.h>
#include <time.h>
#include <unistd.h>
int *a;
char filename[100]="";
//!stores the current string
char stri[]="";
//!stores the encrypted version
char encrypted[]="";
//!A function to take and check for correct integral.
int* readinput()
{
a=(int*)mall... |
C | #include<stdio.h>
#include<string.h>
void main()
{
char s[100];
int i,count=0;
gets(s);
for(i=0;s[i]!='\0';i++)
{
count++;
}
printf("%d",count);
}
|
C | #include <stdio.h>
/**
* main - Prints all single digit numbers of base 10
*
* Return: 0 if succes
*/
int main(void)
{
printf("0123456789\n");
return (0);
}
|
C | #ifndef _KEYBOARD_H
#define _KEYBOARD_H
#include "types.h"
/***
*
* if err == KEY_NO_ERROR , then check nonPrintableAscii variable
* otherwise, an error exists.
* KEY_ERR1: a general keyboard error was detected as scancode 0x00 or 0xFF
* KEY_ERR2: internal failure was detected as scancode 0xFD
* KEY_ERR3: "keyboard... |
C | #ifndef NUC_LOCAL_H
#define NUC_LOCAL_H
// C Standard Library
#include <string.h>
// Nucleus Headers
#include "../../common.h"
#include "../emit.h"
#include "../global.h"
#include "../lexer/token.h"
#include "../parser/declaration/variable.h"
#include "../parser/expression.h"
#include "../parser/parser.h"
#include "t... |
C | #include <stdio.h>
#include <math.h>
int main()
{
float floatNum;
printf("Please input a float number:");
scanf("%f", &floatNum);
printf("floatNum=[%0.16f]\n", floatNum);
if(fabs(floatNum - 0.0) < 1e-6)
{
printf("floatNum is zero\n");
}
else if(floatNum > 1e-6)
{
p... |
C | /* ** por compatibilidad se omiten tildes **
================================================================================
TRABAJO PRACTICO 3 - System Programming - ORGANIZACION DE COMPUTADOR II - FCEN
================================================================================
definicion de funciones del sch... |
C | #include<stdio.h>
main()
{
int l,s,i,a,b;
while(scanf("%d%d",&l,&s))
{
if(l==0&&s==0) break;
while(s--)
{
scanf("%d%d",&a,&b);
l-=-a+b+1;
}
printf("%d\n",l+1);
}
}
|
C | #include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "checkSum.h"
#include <assert.h>
#include "../include/trie.h"
void acknowledge();
static void addBrand(Trie);
int main(int argc, char **argv) {
acknowledge();
Trie t = newTrie();
addBrand(t);
// ============================================... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "fk_circular_buffer.h"
void free_buffer(circularBuffer_t *p_buffer) {
free(p_buffer->p_data_location);
p_buffer->p_data_location = NULL;
}
int init_buffer(circularBuffer_t *p_buffer, size_t buffer_size, size_t data_size) {
void *storage;
free_bu... |
C | /*
============================================================================
Name : S-2-2.c
Author : Gonzalez Ricardo 1-F
Ejercicio 2-2:
Realizar un programa que permita el ingreso de 10
nmeros enteros.
Determinar el promedio de los positivos,
la cantidad de ceros y del menor de los negativos
la... |
C | #include "adc.h"
void Adc_Init(void)
{
ADC_InitTypeDef ADC_InitStructure;
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA|RCC_APB2Periph_GPIOB|RCC_APB2Periph_GPIOC|RCC_APB2Periph_ADC1|RCC_APB2Periph_ADC2, ENABLE ); //ʹADC1ͨʱ
RCC_ADCCLKConfig(RCC_PCLK2_Div6); ... |
C | #include "../include/race.h"
#include "race_int.h"
race_t *race_job_new(void)
{
return (calloc(1, sizeof(race_t)));
}
void race_job_free(race_t *r)
{
race_conn_param_deinit(&r->conn_param);
free(r);
}
int race_set_option(race_t *r, race_option_t opt, size_t arg)
{
unsigned p_uint = (unsigned)arg;
... |
C | #include "command_other.h"
int launch(char **args)
{
char path[100];
bzero(path, 100);
strcat(path, "/bin/"); //将两个char类型连接
///bin: /usr/bin: 可执行二进制文件的目录,如常用的命令ls、tar、mv、cat等。
strcat(path, args[0]);
int rc = fork();
if (rc > 0)
{ //父进程
waitpid(-1, 0, 0);
}
else if (rc ==... |
C | #include <stdio.h>
/*********************************************
Nome: Samuel Toyoshi Ishida
RA: 160250
Turma: T
Laboratorio Fruit Crush Saga - Part II
**********************************************/
#define MAX 52
/*remove as frutas e ajusta o tabuleiro*/
void remFrutas(char tab[][MAX], int x, in... |
C | #include <stdio.h>
#include <stdlib.h>
/*
ó 迭 Ҵ 10¥ Ҵ Ŀ
ڸ 0 Էҋ Է
Է ٰ 迭 ߰ 3 迭 ø
0 Է Է ڵ ϴ ڵ带 ۼ
*/
int main(void) {
int* arr;
int size = 10;
int idx = 0, i, total = 0;
//Ҵ
arr = (int*)malloc(sizeof(int) * size);
while (1) {
// ڸ Ҵ
if (idx == size) {
size += 3;
arr = (int*)realloc(arr, sizeof(i... |
C | #include <stdio.h>
#include <stdbool.h>
void sort(int arr[], int n)
{
int i, key, j;
for (i = 1; i < n; i++) {
key = arr[i];
j = i - 1;
while (j >= 0 && arr[j] > key) {
arr[j + 1] = arr[j];
j = j - 1;
}
arr[j + 1] = key;
... |
C | #include<stdio.h>
#include<string.h>
#define start m##a##i##n
int start()
{
char str[30];
strcpy(str,"i am a coder");
printf("the contained string is %s",str);
getch();
return 0;
}
|
C | #include <stdio.h>
#include <stdlib.h>
struct TreeNode {
int val;
struct TreeNode *left;
struct TreeNode *right;
};
struct QueueNode {
void * ptr;
struct QueueNode *next;
};
struct Queue{
struct QueueNode *front;
struct QueueNode *tail;
};
void push(struct Queue *queue... |
C | /*****************************************
Filename: PWM_thru_GPIO.c
Author: James Massucco
Date: 11/03/2014
Purpose: Produce PWM signal which is on
for 2000usec with a period of
20000usec.
IMPORTANT NOTE:
The GPIO initialization script,
GPIO_I... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* lemin__room_show.c :+: :+: :+: ... |
C | /*
* main.c
*
* Created on: May 29, 2021
* Author: cory
*/
#include <sys/types.h>
#include <dirent.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include "tlpi_hdr.h"
#include <string.h>
struct path_list {
char *name;
__ino_t inode;
__dev_t device;
struct path_list *next;
struct pat... |
C | #include <stdio.h>
#include <string.h>
#define maxn 100
int left, chance;
char s[maxn], s2[maxn];
int win, lose;
void guess(char ch);
int main(int argc, char *argv[])
{
int rnd;
while (scanf("%d%s%s", &rnd, s, s2) == 3 && rnd != -1)
{
printf("Round %d\n", rnd);
win = lose = 0;
left = strlen(s);
chance... |
C | /* File Comment
* ---------------------------------------------------------------------------------------------------
* [FILE NAME]: <adc.h>
*
* [AUTHOR]: Abdallah Hossam-Eldin Hosny
*
* [DATE CREATED]: <31 - 10 - 2020>
*
* [DESCRIPTION]: <Header file for ADC(Analog to Digital Converter>
* --------------------... |
C | #include <stdio.h>
#include <stdlib.h>
#define TAM 2
int buscarLibre(int[], int);
void mostrarAlumnos(int[], char[][20], int[], int[], float[], int);
float calcularPromedio(int, int);
int cargarAlumno(int[], char[][20], int[], int[], float[], int);
void pedirDatos(int[], char[][20], int[], int[], float[], int,... |
C | // 二叉树搜索
#include<stdio.h>
#include<stdlib.h>
// Definition for a binary tree node.
typedef struct TreeNode* tree_node_t;
struct TreeNode {
int val;
tree_node_t left;
tree_node_t right;
int left_space,right_space,pre_space;
};
tree_node_t create_tree_node(int *nums,int len,int idx);
// 创建二叉树
tree_n... |
C | /*
5-17-19
Plays a simple tune, broadcasts it in the AM radio band.
We wiggle the volume envelop of the carrier with a pitch.
The idea is to create a radio signal that has a carrier (high constant frequency signal 1 MhZ) and a radio signal that will
modulate the amplitude of the carrier. The radio signal has a... |
C | /***************************************************************************************************************************************
Problem:
Write a program that calls fork(). Before calling fork(), have the main process access a variable (e.g., x) and set its value to something (e.g., 100).
What value is the va... |
C | //еĻʵ
#ifndef _QUEUE_H_
#define -QUEUE_H_
typedef struct QNode
{
QElemType data;
struct QNode *next;
}QNode,*QueuePtr;
typedef struct
{
//
QueuePtr front;//ͷָ룻
QueuePtr rear;//βָ
}LinkQueue;
Status InitQueue(LinkQueue &Q);
Status DestroyQueue(LinkQueue &Q);
Status ClearQueue(LinkQueue &Q);
Status QueueEmpty (LinkQ... |
C | /*
* ReadIndex.c
*
* Created on: Oct 26, 2012
* Author: Jonas Schreiber
*/
#ifndef READINDEX_C_
#define READINDEX_C_
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "Files.h"
#include "Words.h"
#include "Search.h"
struct Words * readIndex(FILE * file) {
struct Words word = malloc(size... |
C | #include "console.h"
#include "gdt.h"
#include "idt.h"
#include "isrs.h"
#include "irq.h"
#include "timer.h"
#include "kernel.h"
#include "kbd.h"
#include "multiboot.h"
#include "rand.h"
/* We will use this later on for reading from the I/O ports to get data
* from devices such as the keyboard. We are using what is c... |
C | #include "stdio.h"
#include "string.h"
#include "bsp.h"
#include "CC1101.H"
#define LED_GPIO_PORT GPIOA
#define LED_GPIO_PINS GPIO_Pin_6
volatile u16 Cnt1ms = 0; // 1msÿ1msһ
int RecvWaitTime = 0; // յȴʱ
u16 SendCnt = 0; // ͵ݰ
/... |
C | /*
Primer mejoramiento: {
Solicitar datos de la cuenta
Validar si el usuario excede el limite de credito de su cuenta
Si excede el limite de credito de su cuenta entonces escribir en pantalla que excedio el limite de crédito. \
}
Segundo mejoramiento: {
Solicitar numero de cuenta, saldo inicial del me... |
C | #include <stdbool.h>
#include <stdlib.h>
#include "backpack.h"
#include "item.h"
#include "container.h"
struct backpack* create_backpack(const int capacity) {
struct backpack* batoh = calloc((size_t) 1, sizeof(struct backpack));
if(batoh == NULL) {
return NULL;
}
batoh->capacity = capacity;
... |
C | #include <stdio.h>
int p1()
{
long long n;
int i;
int k;
int num;
while(scanf("%lld", &n) == 1 && n != 0)
{
while(n>0)
{
k = 0;
scanf("%d", &num);
for(i = 1; i*i < num; i++)
if(num % i == 0)
k += 2;
if(i*i == num) k++;
printf("%d\n", k);
n--;
}
}
} |
C | int strcmp(const char *str1, const char *str2) {
const char *it1 = str1;
const char *it2 = str2;
while (*it1 && *it2 && it1 == it2) {
it1 += 1;
it2 += 1;
}
return *it1 - *it2;
} |
C | #include <stdio.h>
#include <cs50.h>
#include <math.h>
unsigned long sumDigits(long long number)
{
unsigned long sum = 0;
while (number != 0)
{
int digit = number % 10;
sum += digit;
number /= 10;
}
return sum;
}
int main()
{
// get input from user and save it to variab... |
C | #include <stdio.h>
#include <stdlib.h>
#include<locale.h>
#include<string.h>
#include<conio.c>
#include<windows.h>
#include<ctype.h>
#include "funcoes.c"
#include "parteprodutos.c"
#include "RCL.c"
int main(){
int cont=0;
char vet[30]="";
while(cont <= 100){
gotoxy(5,10);
printf("Carregan... |
C | #include "player.h"
#include "dice.h"
static int keep [N_DICE];
int keepWhichDice(void){
int answer;
printf("input one die at the time that you want to keep, Finish with a 0\n");
while(TRUE){
answer = GetInteger();
if(answer == 0) break;
keep[answer - 1] = KEEP;
}
}/*
int getrow(int index){
int r... |
C | /*
* Ficheiro: mesh.h
*
* Definicao da malha de entrada.
*
* Input mesh definition.
*/
#ifndef _MESH_H_
#define _MESH_H_
/* Constants. */
/* To ensure the minimal distance of the main distribution wires. */
#define Y_BASE_STEP 3
/* Data structures. */
typedef struct Clock_Zone_Str{
int clk; /* Numerical value... |
C | /**
* @file : LESSON_33 project file
* @author : MEHMET AKSU
* @note : mmtaksu.25@gmail.com
* @date : 11 / September / 2020
* @code : normal_termination_exit.c file
* @details :
*/
#include <stdio.h>
#include <stdlib.h>
void f4()
{
printf("f4() basladi\n");
exit(EXIT_FAILURE);
print... |
C | /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*
* Stego.c: A program for manipulating images *
*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
#include <string.h>
#include "image.h"
/*
THE WAY BYTES ARE INDEXED
00000000 00000000... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.