language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /*
NAME: Ashwin Narkar
EMAIL: ashwin.narkar@gmail.com
ID: 204585474
*/
#include <stdio.h>
#include <stdlib.h>
#include <getopt.h>
#include <signal.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include "fcntl.h"
#define UNUSED(expr) do { (void)(expr); } while (0)
int dump_core_flag;
void createSe... |
C | //思路与 1106 差不多
//注意优化,容易超时
#include<stdio.h>
#include<stdlib.h>
typedef struct section_
{
int supplier;
int increment;
} section;
int main()
{
int n,i,supplier,max=0,max_count=0,count=0,temp;
double p,r;
section *chain;
scanf("%d%lf%lf",&n,&p,&r);
r/=100;
r+=1;
chain=(section *)malloc(n*sizeof(section));
for(... |
C | //
// main.c
// MGraphDemo
//
// Created by SK on 2020/5/1.
// Copyright © 2020 SK_Wang. All rights reserved.
//
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include "Queue.h"
#define INFINITYC 0
#define MAX_VERTEX_NUM 50
#define TRUE 1
#define FALSE 0
typedef i... |
C | #define _CRT_SECURE_NO_WARNINGS 1
//------------------5
#include<stdio.h>
int main()
{
char ch = getchar();
putchar(ch);
printf("%c\n",ch);
return 0;
}
////------------------4
//#include<stdio.h>
//int main()
//{
// int i = 1;
// while(i<=10)
// {
// if(5==i)
// continue;
// //Աѭcontinue䣬... |
C | #include <sys/socket.h>
#include <netinet/in.h>
#include <stdio.h>
#include <string.h>
#include <sys/select.h>
#include <arpa/inet.h>
int max = 10;
int BUFLEN = 5000;
int main(int argc, char **argv){
int sockfd = socket(AF_INET, SOCK_DGRAM, 0);
struct sockaddr_in my_addr, cli_addr[max],cli_temp;
socklen_t slen[... |
C | #include <stdio.h>
#include <pthread.h>
#include <unistd.h>
#include <stdbool.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <signal.h>
#include "../shm_protocol.h"
volatile bool quit = false;
int sh_fd;
const struct shm_data *src;
int shm_init() {
sh_fd = shm_open(SHMEM_NAME, O_RDONLY, 0600);
if (sh_f... |
C | #define _CRT_SECURE_NO_WARNINGS 1
//ָoffer-3-άеIJ
//Ͼ
//һ־ÿдǵģϵǵģдľвijǷڡ
//Ҫʱ临ӶСO(N);
#include<stdio.h>
//1.---ʱ临Ӷȸ
//int main()
//{
// int arr[3][3] = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
// int a, b, i, j;
//printf("Ҫҵ֣");
//scanf("%d", &a);
// for (i = 0; i < 3; i++)
// {
// for (j = 0; j < 3; j++)
// {
// b = arr[... |
C | void create_board(char board[10][10]) {
int row, column;
for (row = 0; row < 10; row++) {
for (column = 0; column < 10; column++) {
board[row][column] = '.';
}
}
} |
C | #include <stdio.h>
void print_num(int num) {
if (num < 10) {
printf("%d\n", num);
return;
}
print_num(num/10); // 当num/10<10时,开始return
printf("%d\n", num % 10);
}
int main(int argc, char *argv[]) {
int num = 8793;
print_num(num);
} |
C | #include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdint.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
struct _progress {
int fd;
FILE *out;
double period;
uint64_t count;
double start;
double now;
double last;
off_t fd_size;
off_t fd_pos;
};
struct _progress *P;
... |
C | #ifndef UTILITY_H
#define UTILITY_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void print_array(int array[], int size)
{
printf("{");
for(int i = 0; i < size - 1; i++)
{
printf("%d, ", array[i]);
}
printf("%d}\n", array[size - 1]);
}
void swap(int* a, int* b)
{
int tem... |
C | /**/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
void reverse(char *arr, int i, int j){
if(i==j)
return;
//printf("%d", i);
char temp;
while(i<=j){
temp=arr[i];
arr[i]=arr[j];
arr[j]=temp;
i++;
j--;
}
}
void reversedots(char *str, int n){
reverse(str,0,n-1);
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <signal.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/wait.h>
int main(int argc , char * argv[]) {
pid_t child;
int prime;
int out[2];
if(read(0 , (void *)&prime , sizeof(int))... |
C | /* Este codigo ha sido generado por el modulo psexport 20160506-w32 de PSeInt.
Es posible que el codigo generado no sea completamente correcto. Si encuentra
errores por favor reportelos en el foro (http://pseint.sourceforge.net). */
#include<stdio.h>
int main() {
float a;
float b;
float r;
a = 0;
b = 0;
r = 0;
... |
C | #include <assert.h>
#include "ParseTreeBuilder.h"
#include "SymbolTable.h"
#include "Math.h"
nodeType* constantNum(double value)
{
nodeType *p;
/* allocate node */
if((p = malloc(sizeof(constantNodeType))) == NULL)
yyerror("Out of memory encountered.");
assert(p);
/* copy information */
... |
C | /* ************************************************************************** */
/* */
/* :::::::: */
/* realbuffer.h :+: :+: ... |
C | /*
* MIT License
*
* Copyright (c) 2020 Nicholas Fraser
*
* 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, ... |
C | /**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the libintl for msvc.
* No warranty is given. You can use this at your own risk.
*/
#include <minwindef.h>
#include <wchar.h>
#include <winapi.h>
#include <memory.h>
#include <errno.h>
#include "config.h... |
C | /************************************************
* Organisation Name : Dot Hex Technology.
* Developer Name : Prashant P. Hirave.
* Controller : At89C51RD2
* IDE : Keil4, Keil5.
* Language : Embedded C.
*************************************************/
/*
On P0.0 - P0.7 attched four 7_segments
and P2.0 ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h> // for open
#include <unistd.h> // for close
#include <time.h> // time...
// Value in .data to change
int val = 0xbaadaa55;
int main() {
setvbuf(stdout, NULL, _IONBF, 20);
setvbuf(stdin, NULL, _IONBF, 20);
c... |
C | #include<stdio.h>
long long int power(int a,int b)
{
int i;
long long int p=1;
for(i=0;i<b;i++)
p*=a;
return p;
}
int min(int a,int b)
{
return a<b?a:b;
}
calsin(int s,int c,int k)
{
long long int answers;
if(s!=0 && k<=s)
answers=power(2,s-k+1)+1;
else
answers=0;
return answers;
}
calcos(int s,int c,int... |
C | #ifndef __ASM_SPINLOCK_TYPES_H_
#define __ASM_SPINLOCK_TYPES_H_
typedef struct {
volatile unsigned int lock;
}spinlock_t;
#define spin_is_locked(x) (*(volatile char*)(&(x)->lock) <=0)
#define spin_lock_string \
"\n1:\t"\
"lock; decb %0\n\t" \
"js 2f\n" \
".section .text.lock,\"ax\"\n" \
"2:\t"\
"cmpb $0,%0... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define TPS 8 // tile pattern size (for tiled RGB565)
#define HBG 256 // actual height of backgrounds
#define HBGV 240 // visible height of backgrounds
#define RD_BE( v, dt, n ) v = 0; for( int i = 0; i < (n); i++ ) v += (dt)[ i ] << ( i * 8 )
#define WR_... |
C | #include <stdbool.h>
#include <flut/flut.h>
#include "../../src/text/Regex.c"
#define flut_assert_token_result_is(expected, regex) \
do { \
flut_assertion_explainv( \
assert_tokenize((expected), (regex)), \
"Regex `%s` sho... |
C | #include <stdio.h>
char *ft_strcpy(char *dest, char *src);
int main(void)
{
char *src = "Hello";
char dest[6];
ft_strcpy(dest, src);
printf("%s\n", dest);
return (0);
}
|
C |
/* Not free Error Case */
#include <stdlib.h>
int gv = 1;
int a = 0;
int *fnc1(int *ptr1){
int *a = ptr1;
return a;
}
int *fnc2(int *ptr2, int *ptr3){
return ptr2;
}
void fnc3(int *ptr2, int *ptr3){
int a = 0;
free(ptr2);
free(ptr3);
}
void c1(){
int a = 0;
}
void c2(){
int a = 0;
}
void c3(){
int ... |
C | #include <stdio.h>
char *ft_strcapitalize(char *str);
int main()
{
char A[] = "+hi MYNAME +iS?mrpussy+w+h+a+t 024810asd";
int size = sizeof(A)/sizeof(A[0]);
ft_strcapitalize(A);
int i;
for ( i = 0; i < size; i++)
{
printf("%c", A[i]);
}
} |
C | #include <stdio.h>
#include <stdlib.h>
#include "numeroNatural.h"
#include "input.h"
#define TAM 10
int main()
{
char seguir='s';
char auxOpcion[2];
int opcion=0;
int validado;
numeroNatural num[TAM];
inicializarNum(num, TAM);
hardCodeNum(num, TAM);
while(seguir=='s')... |
C | /*
1. itoa() function converts int data type to string data type.
2. atoi() function converts string data type to int data type.
Sample Input
"100" 135
Sample Output
100 "135"
*/
#include<stdio.h>
void itoa(int num, char* result)
{
int rem,count=0,num1=num,len,i=0;
while(num){
count++;
num = ... |
C |
#include "cond.h"
//#include "lock.h"
#include "3140_concur.h"
#include "shared_structs.h"
/**
* Initialises the conditional variable structure
*
* @param l ignored
* @param c pointer to conditional variable to be initialised
*/
void c_init(lock_t* l, cond_t* c) {
c -> lock = l; // Lock va... |
C | #include <stdio.h>
int K;
int p[200001];
int equals(int A, int n) {
int i;
for (i = 0; i < n; i++)
if (p[i] == A)
return 1;
return 0;
}
void fun(int A, int B, int *c, int n) {
if (A == 0)
return;
if (equals(A, n)) {
*c = -1;
return;
}
if (A-K >= 0) {
int newB = B + K;
int newA = B+A-newB;
(*c)+... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_re_push_to_b.c :+: :+: :+: ... |
C | #include<stdio.h>
#include<pthread.h>
#include<sys/types.h>
#include<stdlib.h>
int no_of_threads = 3;
int count = 2;
char *message = "naveen reddy";
void *new_thread(void *arg)
{
/*this is routine of thread define what the thread does*/
int i;
for(i=0 ; i<count ;i++){
printf("%s\n",message);
sleep(1);
}/*thr... |
C | #include<stdio.h>
#include<stdarg.h>
#define _get_argnum(...) _get_argnum2(__VA_ARGS__,64,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)
#define _get_argnum2(r1,r2,r3,r4,r5,r6,r7,r8,r9... |
C | #include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
void perform_work(int k, int t);
void *thread(void *vargp);
int leonardo_number(int n);
struct Arguments {
int *k;
int *t;
};
int main(int argc, char **argv) {
int n = argc == 2 ? atoi( argv[1] ) : 0;
if (argc != 2) {
fprintf(stde... |
C | #include <stdio.h>
#include <limits.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include "ex00/ft_strcmp.c"
#include "ex01/ft_strncmp.c"
#include "ex02/ft_strcat.c"
#include "ex03/ft_strncat.c"
#include "ex04/ft_strstr.c"
#include "ex05/ft_strlcat.c"
int main()
{
int ch;
system("clear||cls");
... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct student_record
{
char clas[50];
char name[50];
char email[50];
char contact[50];
char prn[50];
int rollno;
struct student_record *next;
}student_record;
struct student_record *head;
void insert_data(int n)
{ int i;
struct s... |
C | /*
Сортировка и поиск
Составить программу на Си с использованием процедур и функций для сортировки таблицы заданным методом и двоичного поиска по ключу в
таблице.
Программа должна вводить значения элементов неупорядоченной таблицы и проверять работу процедуры сортировки
в трех случаях:
1. элементы таблицы с са... |
C | /**
* SetHours_FR.h
* Klasse fuer das Setzten der Stunden in Franzoesisch.
*
* @mc Arduino/RBBB
* @autor Christian Aschoff / caschoff _AT_ mac _DOT_ com
* @version 1.1
* @created 14.12.2012
* @update 18.1.2013
*
* Versionshistorie:
* V 1.1: - Optimierung hinsichtlich Speicherbedarf.
*/
#ifndef... |
C | \
// Include files
#include <time.h>
#include <sys/stat.h>
#include <dirent.h>
#include <errno.h>
#include <iostream>
#include <sstream>
#include <fstream>
#include "TColor.h"
#include "TStyle.h"
#include "TSystem.h"
#include "CommonTools.h"
bool CommonTools::exists(std::string file)
{
FileStat_t x;
return (not ... |
C | /**************************************************************
* Linux Unix Domain Socket for Latency Testing Server *
* by Daniel Wang and Kevin Dennis *
***************************************************************/
#include <stdio.h> /* For printf */
#include <stdlib.h> /* For ... |
C |
#include <Python.h>
#include <numpy/arrayobject.h>
#include <math.h>
static PyObject *sepia(PyObject *self, PyObject *args)
{
PyArrayObject *srcarray;
if (!PyArg_ParseTuple(args, "O", &srcarray)) {
fprintf(stderr, "invalid argument\n");
return Py_None;
}
if (srcarray->nd != 3) {
fprintf(stderr, "invalid im... |
C | #include <dstructs/treemap.h>
#include <dstructs/stack.h>
#include <stdlib.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <time.h>
/* constants */
enum constants
{
SOLUTION = 0x7fffffff,
POPULATION_MAX = 1000,
};
/* typedefs */
typedef int (*compa... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include"define.h"
void InitAQueue(AQueue *Q) //ʼ
{
int i;
Q->length = MAXQUEUE;
Q->front = Q->rear = 0;
}
int LengthAQueue(AQueue *Q) //ȷг
{
return (Q->rear - Q->front + Q->length) % Q->length;
}
Status IsEmptyAQueue(const AQueue *Q)//ǷΪ
{
return (Q->fr... |
C | #include <stdio.h>
int main()
{
int n;
for(n=0;n<10;n++) {
printf("数字%d\n", n);
}
return 0;
} |
C | #include "../../peripheral/peri_dht1122.h"
#include "../../pando/pando_object.h"
#include "c_types.h"
#include "user_interface.h"
#include "temperature.h"
// add your own includes below
#define TEMPERATURE_OBJECT_NO 1
struct temperature {
float32 centigrade;
};
void ICACHE_FLASH_ATTR
temperature_init() {
// TODO: ad... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int intCompare(const void* intOne, const void* intTwo){ /* Compares two values, returns a positive if the first value is larger, a zero if the values are equal, and a negative if the second value is larger. For use with qsort, as a void pointer it takes any ty... |
C | #include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
struct treeNode
{
long item;
int count;
struct treeNode *pLeft;
struct treeNode *pRight;
};
struct treeNode *createNode(long value);
struct treeNode *addNode(long value, struct treeNode *pNode);
void listNodes(struct treeNode *pNode); //遍... |
C | #include <stdlib.h>
#include <stdio.h>
#include "lib/palindrome.h"
int main() {
int check[] = {
1001,
232,
29492,
199,
80,
9182819
};
long unsigned largest = 0;
for(int i = 999; i > 99; i--){
for(int j = 999; j > i; j--){
long unsigned product = i * j;
if(product <= lar... |
C | #include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <wait.h>
int main(int argc, char **argv){
pid_t filho, filho2, neto1, neto2, bisneto;
int val, value, value2, value3;
//creating pipe
int fd[2], sf[2], st[2], fc[2];
pipe(fd);
pipe(sf);
pipe(st);
pipe(fc);
filho = fork();
switch(filho){
... |
C | #include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
typedef enum { FALSE, TRUE } boolean;
// Adapted from http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp?topic=/rzahw/rzahwe17rx.htm
// Fixed to eliminate nonstandard pthread_getthreadid_np()
// Bug fixes
#define checkResul... |
C | /*
** EPITECH PROJECT, 2019
** PSU_minishell1_2019
** File description:
** get_path.c
*/
#include "proto.h"
#include <stdlib.h>
int my_strlen(char *str)
{
int len = 0;
if (str == NULL)
return 0;
for (; str[len]; len++);
return len;
}
char *my_str(char *str)
{
char *s = malloc(sizeof (char... |
C | /*
* Michael Kerrisk: The Linux Programming Interface. Exercise 5-1
*
* Modify the programm in Listing 5-3 (accessing the large file) to use standard file I/O
* system calls open() and lseek() and the off_t data type. Compile the programm with the
* _FILE_OFFSET_BITS macro set to 64, and test it to show that a lar... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
typedef struct node {
int val;
struct node * next;
struct node * back;
} Node;
int push_back(Node ** rootPtr, int data) {
//needs node pointer pointer to send node * root by reference
Node * current;
if(!(rootPtr)){
return 0; //check for bad input t... |
C |
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
//socket libs
#include <sys/socket.h>
#include "struct.h"
#include "socket.h"
#include "operations.h"
#define DEBUG 0
int recv_mess(int * servers_id,int nb_inter, int nb_machines,int nb_queues, int interval_size, Message_kind * what_... |
C | #ifndef COLOR_H
#define COLOR_H
#define WHITE_COLOR(d) Color_GetColor1(255, 255, 255, d)
#define BLACK_COLOR(d) Color_GetColor1(0, 0, 0, d)
#define RED_COLOR(d) Color_GetColor1(255, 0, 0, d)
#define GREEN_COLOR(d) Color_GetColor1(0, 255, 0, d)
#define BLUE_COLOR(d) Color_GetColor1(0, 0, 255, d)
#ifndef OC2K1x
typedef... |
C |
//VARIABLES GLOBALES
int **ADJ=NULL;
int NN;
int load_inst(char *fn)
{
FILE *fp;
char tmp[100];
int i,j;
char tmpc,tmpe;
if(!(fp=fopen(fn,"r")))
return -1;
while(!feof(fp))
{
fscanf(fp,"%c",&tmpc);
switch(tmpc)
{
case 'c':
fgets(tmp,50,fp);
break;
case 'p':
... |
C | /*
queue implementation using singly linked list
dsjk
*/
#include<stdlib.h>
#include<stdio.h>
#include "ll.h"
#define MAX_QUEUE_SIZE 10
int dequeue(list_element **phead); // removes one element from the end, returns the value
void enqueue(list_element **phead,int value); // inserts one element to the front
v... |
C | #include <signal.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
#define TRUE 1
#define FALSE 0
void kill_me();
void event_loop(int sig);
#define EVENT_EXIT 5
static int timer = 0;
static int reset= FALSE;
static int gotdata=0;
void sighandler(int signo)
{
p... |
C | /*
* ask for a string and return a reply.
*/
#include <stdio.h>
char *
ask(reply, msg)
char *reply, *msg;
{
printf("Enter: %r ", &msg);
fflush(stdout);
return (gets(reply));
}
|
C | /*Chama-se de quadrado mgico um arranjo, na forma de um quadrado, de N x N nmeros inteiros tal que todas as linhas, colunas e diagonais tm a mesma soma.
Por exemplo, o quadrado abaixo
2 7 6
9 5 1
4 3 8
um quadrado mgico de soma 15, pois todas as linhas (2 + 7 + 6 = 15, 9 + 5 + 1 = 15 e 4 + 3 + 8 = 15), colunas (2... |
C | #pragma once
#include <pebble.h>
#include "types.h"
/*! \addtogroup test
* The test framework.
* @{
*/
/*!
* Declares a new test with small footprint.
* \see NGFX_BIG_TEST
*/
#define NGFX_TEST(module,name,...)
/*!
* Declares a new test with big footprint.
* \note After name you open a code block with curly... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_is_valid.c :+: :+: :+: ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* rush03.c :+: :+: :+: ... |
C | #include "optionsParser.h"
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
void parseOptionTest(){
noErrorTest();
defaultValueTest();
inputFileErrorTest();
finOptionError();
bitsUsedError();
channelsError();
patternError();
//Faire des assert pour chaques... |
C |
/*
ֺƴԭ
*/
#define MAKE_USER_ID(ch1,ch2) ((((short)ch1)<<8) + ((short)ch2))
#define MAKE_USER_PASSWORD(ch1,ch2,ch3) ((((int)ch1)<<16) +(((int)ch2)<<8) +(((int)ch3)))
/*
λϢĽõĴ
ڴ
*/
void showDoorStateOpened();//֪ͨ ŵ״̬ǿŵġ
void showDoorStateClosed();//֪ͨ ŵ״̬ǹŵġ
void showDoorStateUnkno... |
C | /* history.c */
inherit M_COMMAND;
inherit M_GETOPT;
#define REMOVE_OPTION "remove"
string *usage(void) {
string *lines;
lines = ({ "Использование: история [-h|-r [диапазон]]" });
lines += ({ "" });
lines += ({ "Сохраняются последние двадцать успешных команд. Вы сможете " +
"повторить любую команд... |
C | #define _GNU_SOURCE /* required for dlfcn.h with glibc */`
#include <sys/param.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <dlfcn.h>
#include <fcntl.h>
#include <pthread.h>
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "utlist.h"
struct fil... |
C | /* -- Target program -- */
#include <stdio.h>
int main()
{
printf("PID : %d\n",getpid());
while(1)
{
printf("[-] I'm Alive \n");
sleep(5);
}
return 0;
}
|
C |
void initUltraSonic(){
pinMode(
}
long microsecondsToInches(long microseconds)
{
// According to Parallax's datasheet for the PING))), there are
// 73.746 microseconds per inch (i.e. sound travels at 1130 feet per
// second). This gives the distance travelled by the ping, outbound
// and return, so we divid... |
C | // You are teaching a class on C-programming! You would like to find out whether your teaching
// has been effective, and so you need to compute the average grade your students have received
// on the most recent assignment. These grades (integers) are stored in the file studentGrades.txt.
// The first entry in the ... |
C | //#include <stdio.h>
//
//unsigned int reverse_bits(unsigned int value)
//{
// unsigned int answer = 0;
// unsigned int i;
//
// for(i = 1;i != 0;i <<= 1){
// answer <<= 1;
// if(value & 1){
// answer |= 1;
// printf("answer in if: %d",answer);
// }
// value >>= 1;
// }
// return answer;
//}
//
//int main(void... |
C | #include<stdio.h>
int compare(char *x, char *y)
{
while(*y != '\0')
{
if (*x != *y)
return 0;
x++;
y++;
}
return 1;
}
char *myStrStr(char *s, char *sfound)
{
int ret = 0;
while(*s != '\0') {
if (*s == *sfound) {
ret = compare(s,sfound);
if (ret)
return s;
}
s++;
}
return NU... |
C | #include<stdio.h>
#define MAX 1000
typedef int type;
typedef struct {
int size;
int top;
type a[MAX];
}stack;
int isStackFull(const stack *s){
if(s->top==s->size-1)
return 1;
else
return 0;
}
int isStackEmpty(const stack *s){
if(s->top==-1)
return 1;
else
return 0;
}
type peek(con... |
C | #include <stdio.h>
#include <locale.h>
int main (){
int numero, fatorial, fator;
setlocale (LC_ALL, "");
printf("Calcula o fatorial de um nmero natural:\n\n");
printf("Informe um nmero natural: ");
scanf("%d", &numero);
for (fatorial = 1, fator = 1; fator <= numero; fator++)
fatorial =... |
C | /* Program Number: 22
Student Name: Sai Manish Sasanapuri; Register Number: IMT2018520
Date: 25-02-2020
Description: This program will open a file, call fork, and then write to the file by both the child as well as the parent processes..
*/
#include<stdio.h>
#include<unistd.h>
#include<sys/resource.h>
#include<stdli... |
C | /**
* Filename: structs-0.c
* Save in Folder: ~/workspace/module4/followalongs/structs
*
* Include the stdio library
* Include the cs50 library
* Include the string library
*
* Include the "structs.h" library
* Remember: To include a header file from the current directory the library name must be en... |
C | #include "stm32f30x.h"
#include "iodef.h"
#include "ds18b20.h"
static void _set_high(const DS18B20_DEV* pdev);
static void _set_low(const DS18B20_DEV* pdev);
static uint8_t _read_data(const DS18B20_DEV *pdev);
static const DS18B20_DEV tgdev ={
DS18B20_DQ_PORT,
DS18B20_DQ_PIN,
_set_high,
_set_low,
_read_data,
};
... |
C | #include "node_search.h"
extern CANVAS active_page;
void search_by_name(list *c, char *search) {
list filtered_list = { NULL, NULL };
struct Node *tmp = c->first;
while (tmp != NULL) {
if (strstr(tmp->name, search) != NULL)
filtered_list.last = add_node_to_end(&filtered_list, new_node(tmp->name, tmp->phone_n... |
C | //#include "server_work.h"
#include "logger.h"
void status_message(int status_code, uint8_t* status_string){
// the "string" here is static so I can avoid using heap memory
// uint8_t status_message // I'm not sure what the max length of descriptrions are
//memset(status_message, '\0', BUFFER_SIZE/2); // refre... |
C | #ifndef __THREADPOOL_H__
#define __THREADPOOL_H__
#include "condition.h"
//任务队列
typedef struct task{
void *(*pfun)(void*); //回调函数
void *arg; //回调函数参数
struct task *next;
}task_t;
typedef struct threadpool{
condition_t cond; //同步互斥
task_t *first;
task_t *tail;
int max_thread;
int idle;... |
C | /*14. ǰ
дһַеǰ
ڹǰؿַ ""
ʾ 1:
: ["flower","flow","flight"]
: "fl"
ʾ 2:
: ["dog","racecar","car"]
: ""
: 벻ڹǰ*/
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
char * longestCommonPrefix(char ** strs, int strsSize)
{
int i,j;
if(strsSize==0) return "";
for(i = 0;i < strlen(str... |
C | #include <stdio.h>
int main()
{
int n1;
int i;
int j;
scanf("%d", &n1);
for (i = 0; i < ((2 * n1) - 1); i++)
{
if (i < n1)
{
for (j = (n1 - i); j <= n1; j++)
printf("*");
printf("\n");
}
if (i >= n1)
{
for (j = i; j < ((2 * n1) - 1); j++)
printf("*");
printf("\... |
C | #include "shell.h"
/**
* _getline_command - print "simple_shell$ " and wait for input
* Return: line of string input for user
*/
char *_getline_command(void)
{
char *lineptr = NULL;
size_t shell_user = 0;
if (isatty(STDIN_FILENO))
write(STDOUT_FILENO, "simple_shell$ ", 14);
if (getline(&lineptr, &shell_user... |
C | #include "matrix.h"
void freeStringMatrix(Matrix* matrix)
{
int x;
int y;
for(x = 0; x < matrix->rows; x++)
for(y = 0; y < matrix->columns; y++)
free(matrix->strings[x][y]);
free(matrix->strings);
free(matrix);
}
|
C | /*******************************************************************************
* quat.h
*
* Description:
* This module provides basic quaternion mathematics. Processed quaternions
* have to match the standard quaternion form q = w + xi + yj + zk.
*
* Functions:
* quat_t quat_conj(quat_t q);
* quat_t quat... |
C | #include <stdio.h>
#include <string.h>
int ocorrencias(char *s, char x){
int count, y=0;
for (int i = 0; s[i] != '\0'; ++i) {
if (x == s[i])
++count;
}
return y;
y=0;
}
int main(){
char word[100];
char *s = word;
char x;
printf ("Digite uma palavra: "... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* new_light.c :+: :+: :+: ... |
C | #include<stdio.h>
#include<conio.h>
int main()
{
int No1,No2;
printf("\n Enter two number => ");
scanf("%d%d",&No1,&No2);
printf("========================\n");
printf(" N1= %d N2= %d \n",No1,No2);
No1<No2?printf("\n N2 is Greater..."): printf("\n N1 is Greater...");
printf("\n===========... |
C | inherit "room/room";
object the_monster;
reset(arg) {
object the_hammer;
if (!present("hammer", this_object())) {
the_hammer = clone_object("obj/weapon");
the_hammer->set_name("hammer");
the_hammer->set_alias("heavy hammer");
the_hammer->set_short("a heavy hammer");
the_hammer->set_long("This ... |
C | ///////////////////////////////////////////ͽƮ
// ȣ : [TST]ִ ã
///////////////////////////////////////////
#if 0
#include <stdio.h>
#define INF 0x7fffffff;
int N;
int a[10 + 10][10 + 10];
int cost[10 + 10];
int chk[10 + 10];
int sel;
int sol = 0;
void DIJKSTRA(void)
{
int k, i;
for (k = 0; k < N - 1; k++)
{
// ش... |
C | /**
* @file Task.cpp
*
* @brief Command line config file interface - Implementation
*
* @author Zaigham Khalid
*
* @riskClass N/A
*
* @moduleID N/A
*
* @modulePrefix FP
*
* @copyright No CopyRight. Feel free to use (at your own risk)
*
***************************************... |
C | #include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]){
FILE *archivo;
int aux,i;
if(argc>1){
archivo=fopen("nGuardados.dat","wb");
int p=atoi(argv[1]);
fwrite(&p,sizeof(int),1,archivo);
for( i=0;i<p;i++){
scanf("%d",&aux);
fwrite(&aux,sizeof(int),1,archivo);
//printf("%d;%d",... |
C | #include <stdio.h>
#include <stdlib.h>
#define OBTENER_DIA(fecha) ( ((int)(fecha / 1000000)))
#define OBTENER_MES(fecha) ( (int)((fecha - OBTENER_DIA(fecha) * 1000000) / 10000) )
#define OBTENER_ANIO(fecha) ( fecha - OBTENER_DIA(fecha) * 1000000 - OBTENER_MES(fecha) * 10000)
int main(){
/*
Dada una fecha ... |
C | #include "unity.h"
#include "interfaces.h"
#include <malloc.h>
void setUp(void) {
}
void tearDown(void) {
}
void test_input_transport(void) {
FILE *inp = NULL;
struct Transport *firstTransport = NULL;
struct Transport *secondTransport = NULL;
if ((inp = fopen("/home/dragon/prog/c/procTests/input_files/comp... |
C | /*
File Name: table.h
Compiler: MS Visual Studio 2019
Author: Emmett Janssens, 040858839
Course: CST8152 - Compilers, Lab Section: 012
Assignment: 2
Date: November 10, 2019
Professor: Sv.Ranev
Purpose: To declare and define the attributes that represent
the transitional table of the sca... |
C | #pragma once
#include <stdbool.h>
static const int INITIAL_CAPACITY = 16;
struct vector {
void** data;
int size;
int capacity;
};
typedef struct vector vector;
vector* vector_new(void);
void vector_init(vector* v);
void vector_free(vector* v);
int vector_size(const vector* v);
int vector_capacity(const vector* v... |
C | #include <stdio.h>
#include <stdlib.h>
#include <omp.h>
/**
* Reah Rajmangal, rr2886
* Lab 2, OpenMP
*/
int main(int argc, char **argv) {
double tstart = 0.0, ttaken;
FILE *fp;
char output[100] = "";
if (argc != 3) {
printf("Usage: ./genprime N t\n");
printf("N is a positive number... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include "dx.h"
#include "dx_debug_assert.h"
#include "dx_debug_malloc.h"
#include "dx_util_lock.h"
#include "dx_util_log.h"
#define UTIL_LOCK_TEST_THREAD_COUNT 16
int _util_lock_test_counter;
void* util_lock_test_task(void* arg) {
unsigned long i = 0;... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.