language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | //(p111a_star_c)
#include <stdio.h>
main()
{
int i,j,k;
for(i=1;i<=7;i++)
{
for(j=7;i<=j;j--)
{
printf (" ");
}
for(k=1;k<=i;k++)
printf ("*");
printf ("\n");
}
}
|
C | /* Faça um algoritmo que imprima os múltiplos positivos de 7, inferiores a 1000 */
#include <stdio.h>
#include <locale.h>
int main(void)
{
setlocale(LC_ALL, "Portuguese");
int i;
printf("Múltiplos de 7: ");
for (i=1;i<1000;i++)
{
if (i%7==0)
{
printf("%d ",i);
... |
C | #ifndef AMUL_VMOP_H
#define AMUL_VMOP_H
// Virtual machine op codes (instructions).
// "Actions" are the op codes that actually manipulate the game
// world and can modify state, whereas "Conditions" are purely
// reflective: they inspect the state of the game world and control
// whether one or more actions will be e... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* token.c :+: :+: :+: ... |
C | // Solve a Nurikabe puzzle.
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <gmp.h>
#include "darray.h"
#include "io.h"
#include "zdd.h"
int main() {
zdd_init();
int rcount, ccount;
if (!scanf("%d %d\n", &rcount, &ccount)) die("input error");
int board[rcount][ccount];
... |
C | /*************************************************************************
> File Name: 013strstr.c
> Author:
> Mail:
> Created Time: 2017年09月08日 星期五 23时52分39秒
************************************************************************/
#include<stdio.h>
#include<string.h>
void * mystrstr(char *dest, char *src)
{... |
C | #ifndef _NIO_FORMAT_H
#define _NIO_FORMAT_H
// Based on the basic types listed here:
// https://en.wikipedia.org/wiki/C_data_types
typedef enum _nioFormatterKind {
// Characters.
// The signedness of char is not defined by the
// C standard, so we provide the default as well
// as explicitly signed and... |
C | #include <Base.h>
#include <Uefi.h>
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/MallocLib.h>
#define CPOOL_HEAD_SIGNATURE SIGNATURE_32('C','p','h','d')
typedef enum {
ALLOCTYPE_POOL,
ALLOCTYPE_ALIGNED_PA... |
C | #pragma once
//************************************
// Method: GetPathSuffix
// FullName: ȡļ
// Access: public
// Returns: غ .xxx
// Qualifier:
// Parameter: strFileName ļ.xxx
//************************************
CString GetPathSuffix(CString strFileName);
//************************************
// Meth... |
C | #include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <unistd.h>
#include <stdbool.h>
//globals of the eats and philospehers
pthread_mutex_t lock[20000000];
/*
need thesee global varibales because what I am doing is to create two functions one that dines and one that
will see if it is ready to eat, the ... |
C | /* Script: Night light base object
By inheriting from this object, a structure's graphics is automatically switched,
according to the current state of the day/night cycle.
With this, a structure can for example switch on spotlights at night.
A structure using alternate graphics for day and night must follow the fo... |
C | /* This program contains the implementation of a dynamic array bag */
#include <stdio.h>
#include <assert.h>
#include <malloc.h>
#include "dynamicArrayBag.h"
/* ******************************* *
* Regular dynamic array functions *
* ******************************* */
void initDynArr(struct DynArr *v, int capacity)... |
C | /* Note:Your choice is C IDE */
#include "stdio.h"
#include "graphics.h"//ͼκͷļ
#include "stdlib.h"
#include "time.h"//ʱͷļ
void printXY(int ,int);
void main()
{
int x,y,i=0;
//ͼεĺijʼ
int gdriver=DETECT,gmode;
initgraph(&gdriver,&gmode,"");
setbkcolor(WHITE);
setcolor(RED);
randomize();//
... |
C | #ifndef STRUCTURES_H
#define STRUCTURES_H
// Node definitions
typedef struct node {
char c;
struct node * next;
struct node * prev;
} Node;
// Buffer definition
typedef struct {
Node * head;
int size;
} Buffer;
// Node function declarations
Node * create_node(char c, Node *prev, Node *next);
void remove_node(No... |
C | #include <stdio.h>
#include <GL/glew.h>
#include <GL/gl.h>
#include <SDL2/SDL.h>
#include "loadfont.h"
#define WINDOW_WIDTH 1500
#define WINDOW_HEIGHT 500
void GLAPIENTRY gl_message_callback(GLenum source,
GLenum type,
GLuint id,
... |
C | #include "sort.h"
/**
* selection_sort - function that sort
* @array: array
* @size: size of the array
* Return: Void
*/
void selection_sort(int *array, size_t size)
{
unsigned int i, x, aux;
int min, tmp;
if (array == NULL || size < 2)
return;
for (i = 0; i < size - 1; i++)
{
aux = i;
min = array[i... |
C | #include"stdio.h"
int main()
{
int Limit, Loop, Mark, Total =0;
float Average;
printf("Enter number of subject : ");
scanf("%d",&Limit);
for(Loop = 1;Loop<=Limit;Loop++)
{
printf("Enter the Mark %d\t: ",Loop);
scanf("%d",&Mark);
Total = Total + Mark;
}
Average = Total / Limit;
printf("Total Marks\t: %d\n",Total);
prin... |
C | /* vim:set ts=8 sts=4 sw=4 tw=0 */
/*
* wordbuf.h -
*
* Written By: Muraoka Taro <koron@tka.att.ne.jp>
* Last Change: 11-Aug-2001.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "wordbuf.h"
#define WORDLEN_DEF 64
int n_wordbuf_open = 0;
int n_wordbuf_close = 0;
struct _wordbuf
{
in... |
C | #include <stdio.h>
#include <stdlib.h>
#include <omp.h>
#include "merge_sort.h"
#include "../../utils/gen_random_ints.h"
#include "../../utils/cronometer.h"
int main () {
int length = 10000;
int *unsorted_arr = gen_random_ints(length, length);
struct cronometer c = init_cronometer();
printf("Run... |
C | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include"head.h"
#include"List.h"
#include"fileread.h"
SDataType A[10010];
int partition2(SDataType arr[],int l,int r)
{
//基准元素设为第一个
SDataType v = arr[l];
//i指向基准的下一个元素,j指向最后一个元素
int i = l+1,j = r;
while(1)
{
while(i ... |
C |
#include "dis.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_OP_BYTES 4
#define TOTAL_OP_ROWS 1269
struct row {
char* ops[MAX_OP_BYTES];
char* mnem;
};
struct row r[TOTAL_OP_ROWS];
int ix=0;
// Create a string until null via malloc
char* mk_string(char* str)
{
int i=0;
whil... |
C | #include "binary_trees.h"
#include <stdlib.h>
/**
* binary_tree_height - measures the height of a binary tree
* @tree: pointer to the root node of the tree to measure the height
* Return: size, 0 on failure
*/
size_t binary_tree_height(const binary_tree_t *tree)
{
size_t lh = NULL, rh = NULL;
if (!tree || (!tre... |
C | #include <stdlib.h>
#include <stdio.h>
#define NAME_SIZE 32
struct simple_st {
int i;
float f;
char ch;
};
struct birthday_st {
int year;
int month;
int day;
};
struct student_st {
int id;
char name[NAME_SIZE];
struct birthday_st birth;
int math;
int chinese;
};
#if 0
struct student_st {
int id;
char ... |
C | #include <stdio.h>
//Чij
/*
@return ɹ10
ָӦó
״̬ ָͨ뷵
õ·úIJЧΧڵֵʾ
-10ļлῴӣ
ǵκֵЧֵĿܽʱ͵÷ֿ
*/
int divide(int a, int b, int *result);
int main()
{
int a = 5;
int b = 0 ;
int c;
if(divide(a,b,&c)){
printf("%d/%d=%d\n",a,b,c);
}
return 0;
}
int divide(int a, int b, int *result)
... |
C | /* Program 2.15 Characters and numbers */
#include<stdio.h>
int main(void)
{
char first = 'T';
char second= 20 ;
printf("\n The first example as a letter looks like this - %c", first);
printf("\n The first example as a number looks like this - %d", first);
printf("\n The second example as a letter looks like thi... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define N 65536
#define A 20
int X[N];
int Y[N];
int main(int argc, char **argv)
{
int i;
clock_t start, end;
double cpu_time_used;
srand(time(NULL));
for(i=0; i<N; i++){
X[i] = rand()%1000;
Y[i] = rand()%1000;
}
start = clock();
for... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
typedef unsigned int Elf32_Addr;
typedef unsigned short Elf32_Half;
typedef unsigned int Elf32_Off;
typedef unsigned int Elf32_Sword;
typedef unsigned int Elf32_Word;
#define EI_NIDENT 16
#define MAX_BUF_LEN 1024
//E... |
C | /*
* Employ.c
*
* Created on: May 11, 2021
* Author: facu
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "utn2.h"
#include "Employee.h"
#define TRUE 0
#define FALSE 1
/** \brief To indicate that all position in the array are empty,
* this function put the flag ... |
C | #include <stdio.h>
int main() {
int x = 10;
int y = 100;
if( x > y)
printf(" %d is bigger than %d" , x, y);
else
printf(" %d is bigger than %d" , y, x);
}
|
C | /* Created: 2020/08/23 20:51:43 by Preposterone */
/* Updated: 2020/08/23 21:08:00 by Preposterone */
char *ft_strncat(char *dest, char *src, unsigned int nb)
{
int i;
int j;
i = 0;
j = 0;
while (src[i] && nb)
{
if (!dest[j])
{
dest[j] = src[i];
i++;
nb--;
}
j++;
}
return (dest);
}
|
C | #include<stdio.h>
int main()
{
int *numbers[] = {1, 2, 4, 5};
printf("%d",numbers[5]);
return 0;
} |
C | #include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include "machines.h"
struct numsOut
{
struct machOut out;
int xx;
int yy;
int zz;
char lead1;
char trail2;
char lead3;
int state;
};
// int checkError(int state, int xx, int yy, int zz, char lead1, char trail2, char lead3){... |
C | #include <stdio.h>
int potencia(int a,int b) {
if (b == 0) return 1;
return a * potencia(a,b-1);
}
void main() {
int a,b,pot;
scanf("%d %d", &a, &b);
pot = potencia(a,b);
printf("%d", pot);
}
|
C | #ifndef COMMON_H
#define COMMON_H
#include "apue.h"
// ģ
enum{
FUN_MODULE=0,
TASK1_MODULE=1,
TASK2_MODULE=2,
TASK3_MODULE=3,
};
// Ϣ
enum {
MSG_FUN = 1,
MSG_FUN_RESULT = 2,
MSG_CGI = 3,
MSG_CGI_RESULT = 4,
};
// ź
enum{
SEM_RS485_SEND = 0,
SEM_OMC_RS485 = 1,
SEM_OMC_IR = 2,
SEM_DRV = 3,
SEM_DBSAVE = 4,
};
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf.c :+: :+: :+: ... |
C | /*
* Copyright © 2003-2018 Acronis International GmbH.
*/
#include <string.h>
#include "crc32.h"
#include "pcs_endian.h"
#include "pcs_align.h"
#include "bug.h"
#ifdef HAVE_CRC32_ARM
int crc32_use_arm = USE_NEON | USE_ARM_CRC;
/*
* len - sizeof buffer (multiple of 16 bytes), len should be > 63
*/
unsigned int c... |
C | #include <mpi.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define N 100
void print(int *a, int size) {
for (int i = 0; i < size; i++)
{
printf("%d ", a[i]);
}
printf("\n");
}
int find_max(int *v, int size) {
int max = v[0];
for (int i = 1; i < size; i++) {
if ... |
C | #include "APP/Card.h"
#define PAN_SIZE 9
#define PIN_SIZE 4
#define SPI_FRAME_SIZE 15
#define PAN_LOC 0
#define PIN_LOC PAN_LOC+PAN_SIZE+1
uint8_t PAN[PAN_SIZE+1]={0};
uint8_t PIN[PIN_SIZE+1]={0};
uint8_t SPIFrame[SPI_FRAME_SIZE]={0};
uint8_t initialized=0;
static sint8_t String_compare(uint8_t *str1,ui... |
C | #include "printer.h"
/*MAIN PRINTER DATA STRUCTURE............................................*/
struct sPrinter Printer;
/*.......................................................................*/
void Printer_Init(void)
{
Printer.modal[3] = ABSOLUTE;
Printer.modal[6] = MILIMETERS;
Printer.modal[5] = UNI... |
C | /**
* Specification of the random access traversal concept for iterators.
*/
#ifndef NSTL_CONCEPT_ITERATOR_RANDOM_ACCESS_TRAVERSAL_H
#define NSTL_CONCEPT_ITERATOR_RANDOM_ACCESS_TRAVERSAL_H
#include <nstl/concept/base.h>
#include <nstl/concept/iterator/bidirectional_traversal.h>
#include <nstl/concept/less_than_comp... |
C | /*
created by khanhlt - 13/11/2017
=====
server recv ==> decode/encode ==> send file back to client
*/
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/sendfile.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <arpa/inet.h>
#include <unistd.... |
C | #ifndef UTIL_INCLUDED
#define UTIL_INCLUDED
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
/* uncomment to enable NaN checks */
#define NAN_DEBUG
/* function pointer typedefs for generic containers */
typedef int (*CompareFunction) (void*, void*);
typedef void (*DestroyFunction) (void*);
typedef void* (*Co... |
C | #include <stdio.h>
int main()
{
printf("Enter string to reverse\n");
char str[20];
scanf("%s", str);
int i=0;
for(i=strlen(str)-1;i>=0;i--){
printf("%c", str[i]);
}
return 0;
}
|
C | ///////////////////////////////////////////////////////////////////////////////
// Dvořák Martin
// xdvora2l 3BIT
// ISA project Atom - 2018
///////////////////////////////////////////////////////////////////////////////
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <stdio.h>
#include <stdl... |
C | /**********************************************************************
*
**********************************************************************/
//TODO ANO PASSADO REVER
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <unistd.h>
#define BUFLEN 1... |
C | #include<stdio.h>
#include<string.h>
int main()
{
char s1[50],s2[50],s3[100]=" is a friend of ";
int i;
printf("enter 2 strings s1 and s2:");
gets(s1);
gets(s2);
puts(s1);
puts(s2);
strcat(s1,s3);
strcat(s1,s2);
printf("\"%s\"\n",s1);
return 0;
}
|
C | #include <stdio.h>
int main(void)
{
int score = 0;
do {
if (score != 0) printf("0~100의 범위에서 입력해 주세요. \n");
printf("점수를 입력해 주세요. :");
scanf("%d", &score);
} while (score < 0 || score > 100);
printf("입력한 점수 %d\n",score);
return 0;
}
|
C | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include <ctype.h>
struct incidence_pair{
char c[26]; // Letter in the cipher text
double freq[26]; // Incidence percentage of each letter
};
struct incidence_pair getInciden... |
C | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward d... |
C | #include "configuracion.h"
t_config* configuracion = NULL;
int crearConfiguracion(char* direccion)
{
if(!configuracion)
configuracion = config_create(direccion);
return configuracion? 0 : 1;
}
void destruirConfiguracion()
{
if(configuracion)
config_destroy(configuracion);
}
char* obtenerNombreInstancia()
{
... |
C | #include <stdio.h>
int countAllDivisors(int n)
{
int d;
int i;
d = 0;
for (i = 1; i*i < n; i++)
{
if (n % i == 0) d += 2;
}
if (i*i == n) d++;
return d;
}
//A(n) = 1 + 2 + ... + n
int countDivisorsOfTriangleNum(int n)
{
if (n % 2 == 0)
{
return countAllDivisors(n/2) * countAllDivisors(n+1);
} else ... |
C | #include <stdio.h> // ǥ header
#include <stdlib.h> // malloc, rand, atoi .. , , ڿ ȯ
#include <string.h> // memcpy, strcpy , ڿ Լ
#include <conio.h> // _getch, putch .. MS Cǥ Լ
#include <time.h> // clock... ð ¥ Լ
#pragma warning(disable:4996) // scanf() CԼ
#pragma warning(disable:4477) // unsigned sigend
#... |
C | /*
* tupian.c
*
* Created on: 201677
* Author: Administrator
*/
#include "tupian.h"
#include "TFT.h"
#include "img.h"
u16 Write_Data(u16 LCD_Data_HD, u16 LCD_Data_LD)
{
return (LCD_Data_HD<<8)|LCD_Data_LD;
}
void Show_Image1(unsigned int x0,unsigned int y0,unsigned int width,unsigned int height)
{
unsign... |
C | #include <stdio.h>
void dec2hexa();
int main()
{
int iDecima;
printf("Nhap so thap phan: ");
scanf("%d",iDecima);
dec2hexa(iDecima);
}
void dec2hexa(int iDecima)
{
int iHexa;
while(iDecima > 0)
{
iHexa = iDecima % 16;
switch (iHexa)
{
case 10:
printf("A");
break;
case 11:
printf("B");
... |
C | #include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
#include "defs.h"
#include "globals.h"
#include "combat.h"
#include "tbg.h"
#include "util.h"
#include "items.h"
#include "locations.h"
#include "religion.h"
#include "rand.h"
#include "tbg-big.h"
#include "orders.h"
#inclu... |
C | #include<stdio.h>
#include<math.h>
float determinant(float a[25][25], int k)
{
float s = 1, det = 0,b[25][25];
int i, j, m, n, c;
if (k == 1)
{
return (a[0][0]);
}
else
{
det = 0;
for (c = 0; c < k; c++)
{
m = 0;
n = 0;
for (i = 0;i < k; i++)
{
... |
C | /* Averages the five numbers found in the input file, and then squares each of the individual numbers. All of these values are then printed to the terminal. - Amanda Cuevas */
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main() {
float arr[6];
float arr2[6];
char in[100];
int i;
float avg;
FILE ... |
C | #include "string.h"
char *strcat(char *dst, const char *src) {
strcpy(dst + strlen(dst), src);
return dst;
}
|
C | //progrm for pattern printing hollow start
#include<stdio.h>
#include<conio.h>
int main()
{
int i=0,j=0,c=0,r=0;
char ch ='A';
printf("\n Enter Row & Column Pattern print=");
scanf("%d%d",&r,&c);
printf("\n==================================\n");
for(i=1;i<=r;i++)
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <signal.h>
#include <errno.h>
#include <sys/wait.h>
/*
父进程阻塞 SIGCHLD
父进程忽略 SIGINT, SIGQUIT
*/
int yh_system(const char *cmd) {
pid_t pid;
int status;
sigset_t old_mask, new_mask;
sigemptyset(&new_mask);
... |
C | #include "holberton.h"
/**
* *rot13 - translate to rot13
* @u: Quote
* Return: Always 0.
*/
char *rot13(char *u)
{
int i, j;
char x[52] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
char t[52] = "NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm";
for (i = 0; u[i]; i++)
{
for (j = 0; j <= 52 ... |
C | #include <stdio.h>
#include <math.h>
int main() {
long num= 816535412;
long startsNum = num;
int i;
char b[32]; // storing 16-bit binary as string
printf("change the decimal to binary(32-bit)), starts with %d...\n\n", num);
for(i = 31; i >= 0; i--) {
if((num - pow(2,i))>=0) {
b[31-i] = '1';
print... |
C | #include "Zroutinue.h"
#include <stdio.h>
#include <stdlib.h>
void _generator(Channel ch){
int val = 2;
for(;;){
chwrite(ch, val);
val++;
}
}
//返回一个channel, 并开启一个协程往channel中不断传入从2开始的自然数
Channel make_generator(){
Channel ch = mkch(int, 10);
go(_generator, ch);
return ch;
}
voi... |
C | #include <stdio.h>
#include <string.h>
#include <ctype.h>
int main()
{
int m;
char s[51];
s[50]='\0';
scanf("%d ",&m);
while (m--)
{
gets(s);
int c1=0,c2=0,c3=0,c4=0,c=0,l=strlen(s);
if (l<8||l>16) { puts("NO"); continue; }
for (int i=0;i<l;i++)
if (isupper(s[i])&&!c1) { c1=1;c++; }
else if (islower... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
#define MAX 10
#define TWOMAX 1024
int n; // Number of items
int pown; // 2^n
int cap; // Max weight it can hold
float wts[MAX]; // All the weights
float vals[MAX]; // All the values
float mv = -1; // Maximum value
int mvals[MAX]; // Hol... |
C | /*
Given a text and a pattern, find all occurences of a pattern in a given text.
METHOD1:
Naive approach:
Find all substrings of length equal to the other strings that need to be found. See whatever is
equal to this string.
Time complexity:
length of one substring is it starts from i will be m, so it will end at i+m... |
C |
#include <string.h>
#include<stdio.h>
#include<stdlib.h>
#include <unistd.h>
#include <limits.h>
int programa = 0;
int ejercicio = 0;
int main()
{
char desicion[2];
system("git clone https://github.com/angelo-dising/Programas");
char cwd[PATH_MAX];
if (getcwd(cwd, sizeof(cwd)) != NULL) {
... |
C | //check type:c/cpp
#include <math.h>
#include <setjmp.h>
jmp_buf mark;
double fdiv(double a, double b);
int main(void)
{
int jmpret;
double r, n1 = 1.0, n2 = 0.0;
jmpret = setjmp(mark); //not compliant
if (0 == jmpret)
{
r = fdiv(n1, n2);
}
else
{
return -1;
}
... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdarg.h>
#include <math.h>
#include <stdint.h>
#include "citrine.h"
char* ctr_cparse_current_program;
ctr_source_map* ctr_source_map_head;
int ctr_source_mapping;
/**
* CTRParserEmitErrorUnexpected
*
* Emits a parser error and... |
C | /** @file
The library class provides platform variable cleanup services.
Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _PLATFORM_VARIABLE_CLEANUP_LIB_
#define _PLATFORM_VARIABLE_CLEANUP_LIB_
#include <Guid/VarErrorFlag.h>
typ... |
C | /** Code jam problem 2 */
#include <stdio.h>
#include <string.h>
int tidy(unsigned long l) {
unsigned long afterCurrent = l %10;
unsigned long current;
int brk = 0;
l /= 10;
while (l>1 && !brk){
current = l %10;
if (current > afterCurrent) brk = 1;
afterCurrent = current;
l/=10;
}
curren... |
C | #ifndef PROJECT1_STRUCTS_H_
#define PROJECT1_STRUCTS_H_
const int MAX_COURSELOAD = 5;
struct Course {
char cid[5]; //The id of the course
unsigned char size; //Max number of seats in the course, 0-99
struct Course* next; //Next course in list
}
struct Student {
unsigned int sid; //The id of the stude... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* map.c :+: :+: :+: ... |
C | #include<stdio.h>
#include<conio.h>
main()
{
int a[20],i,n;
clrscr();
printf("Enter n:");
scanf("%d",&n);
printf("Enter array elements ");
for(i=0;i<n;i++)
scanf("%d",&a[i]);
printf("\nArray before sorting\n");
for(i=0;i<n;i++)
printf("%d\t",a[i]);
shellsort(a,n);
printf("\nArray after sorting\n");
... |
C |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
FILE *fi, *fo, *fk;
int i, r;
char key[20], text[100];
fi = fopen("flag.txt", "r");
fo = fopen("encrypted.txt", "w");
fk = fopen("key.txt", "r");
fscanf(fi, "%s", text);
fscanf(fk, "%s", key);
srand(key[0] * key[1] * key[2] * key[3]);
f... |
C | /*
* bitpack.c
* Implementation of the bitpacking interface for 64-bit words.
* Grace Fagan (gfagan01) and Peter Horvath (phorva01)
* COMP40 Spring 2019 - arith
*/
#include <bitpack.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
static uint64_t rshiftu(uint64_t n, unsigned bits);
static uint64_t l... |
C | #include<stdio.h>
#include<dirent.h>
int main(void)
{
DIR *sdcardRoot=NULL;
DIR *sdcardDcim=NULL;
int i=0,j=0;
struct dirent *EntryRoot;
struct dirent *EntryDcim;
if((sdcardRoot = opendir("./"))==NULL)
{
printf("opendir failed!");
return 1;
}
... |
C | #include "head4fifo.h"
int main(int argc, char **argv)
{
if (access(FIFO, F_OK))
{
mkfifo(FIFO, 0644);
}
int fifo = open(FIFO, O_RDONLY);
char msg[50];
bzero(msg, 50);
read(fifo, msg, 50);
printf("from FIFO: %s", msg);
return... |
C |
/*
input:
T lines containing low < up
output:
all primes in range [a, b]
*/
#include <stdio.h>
#include <math.h>
int up = 100000;
int main()
{
FILE *fptr;
fptr = fopen("D:\\input.txt", "r");
if(fptr == NULL)
{
printf("File Pointer Error!");
exit(1);
}
int T,... |
C | /*Estruturas são um tipo de estrutura que permite a combinação de vários tipos de dados diferentes.
Ex: struct aluno{int ra; char nome[100]; char curso[20]}; --> similar a um dict em python.
Uma vez que uma struct foi declarada, podemos ligar outra com a estrutura inicial:
struct aluno; --> struct aluno aluno1, aluno2,... |
C | #include <stdio.h>
#include <signal.h>
#include <stdlib.h>
static char str[100];
static int i = 0;
void handle(int s);
int main(int argc, char **argv) {
if (argc < 2) {
exit(1);
}
sscanf(argv[1], "%s", str);
signal(SIGINT, handle);
while(1){
}
return 0;
}
void handle(int... |
C | /* Jean-Marc Debicki, Jofrey Luc, Thomas Laheurte
Converts text to usable data */
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "pento.h"
#include "display.h"
#include "convert.h"
#include "cst.h"
/*Returns the max between two integers*/
int max(int a, int b){
return (a... |
C | /*
********************************************************************************
** @file uart.c
** @brief Provides UART functionality. Uses buffers to store incomming and
** outgoing characters and interrupts to handle the transmission and
** reception of data.
*********************************... |
C | //201007
//Question 14
#include <stdio.h>
#include <math.h>
int main(){
int A, B, C;
printf("Enter number A: ");
scanf("%d/n", &A);
printf("Enter number B: ");
scanf("%d/n", &B);
printf("Enter number C: ");
scanf("%d/n", &C);
if(A>B){
if(A>C){
printf("A is the largest number\n");
}else{
printf(... |
C | /**
******************************************************************************
* @file bsp_led.c
* @author fire
* @version V1.0
* @date 2013-xx-xx
* @brief ledӦúӿ
******************************************************************************
*/
#include "bsp_led.h"
/**
* @brief ʼLE... |
C | #include<stdio.h>
#include<stdlib.h>
#define b 20 //teacher
void checkequality_prof(int[],int);
void checkequality_sgap(int[],int);
void checkequality_ssap(int[],int);
void checkequality_asp(int[],int);
static int m=0; //stores the index till when while will be exe... |
C | //Diretiva de pré-compilação - uso de bibliotecas.
#include <stdio.h>
//Função main... printf faz parte da biblioteca stdio.h;
void main(){
//int a, b, c;
int a = 10;
int b = a + 1;
int c = b + 2;
printf("Hello World! \n");
// %d indica a posição de um tipo int.
printf("Atualment... |
C | # include <stdio.h>
# include <string.h>
# include <conio.h>
int main(void){
unsigned char i,j;
for(i=1;i<10;i++){
for(j=1;j<10;j++){
if(i>=j)
printf("%01d*%01d=%02d ",j,i,j*i);
}
printf("\n");
}
getch();
} |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* color.c :+: :+: :+: ... |
C | //Write a program to add two user input numbers using 4 functions.
#include<stdio.h>
void inp();
void calculate(int n1,int n2);
void show(int n1,int n2, int s);
void main()
{
inp();
}
void inp()
{
printf("Enter two numbers\n");
int n1,n2;
scanf("%d%d",&n1,&n2);
calculate(n1,n2);
}
void calculate(int... |
C | #include "../structure.h"
int distance(Coordinate position, Coordinate target){
//Pour eviter la racine carre, je renvoie le res au carre.
return ((position.x - target.x)*(position.x - target.x) + (position.y - target.y)*(position.y - target.y));
}
float abso(float x){
if(x < 0){
x *= -1;
}
return x;
}
|
C | #include <dirent.h>
#include <stdio.h>
#include <string.h>
void show_dir_content(char *path) {
DIR *d = opendir(path);
if (d == NULL)
return;
struct dirent *dir;
while ((dir = readdir(d)) != NULL) {
// if the type is not directory just print
if (dir->d_type != DT_DIR)
printf("%s/%s\n", path, ... |
C |
/* Course : CSE 438 - Embedded Systems Programming
* Assignment 2 : To implement GPIO control in User Space
* Team Member1 : Samruddhi Joshi ASUID : 1213364722
* Team Member2 : Varun Joshi ASUID : 1212953337
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
... |
C | #include<stdio.h>
int fabonnaci(int);
int main()
{
int i,number,result;
printf("the num of for writting fabo series");
scanf("%d",&number);
for(i=0;i<number;i++){
result=fabonnaci(i);
printf("\nfab=%d\n",result);}
return 0;
}
int fabonnaci(num){
if(num==0||num==1)
... |
C | #include "sh_malloc.h"
#include "sh_log.h"
#include "jemalloc.h"
#include "sh.h"
#include <stdio.h>
#include <string.h>
#ifdef HAVE_MALLOC
#define PREFIX_SIZE 0
#define malloc je_malloc
#define realloc je_realloc
#define free je_free
#define calloc je_calloc
static inline size_t
malloc_usable_size(void *ptr) {
... |
C | #include "data_handler.h"
#include "defines.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
static char hostUrl[100] = {0};
// Get end point name from URL
eEndPoint ParseEndPointFromUrl(const char* url, int* param)
{
// Todo : need to check host name as well
if (strstr(url, "crea... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
int s[100001],n,i;
int cmp(const void *a, const void *b)
{
return(*(int *)a-*(int *)b);
}
int main()
{
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&s[i]);
qsort(s,n,sizeof(s[0]),cmp);
for(i=0;i<n;i++)
printf("%d ",s[i]);
return 0;
}
|
C | #include <stdbool.h>
// SEASHELL_READONLY
// A Module for a minheap data structure
struct minheap {
int len;
int maxlen;
int *data;
};
// minheap_create() creates a new empty minheap
// effects: allocates memory (client must call minheap_destroy)
struct minheap *minheap_create(void);
// minheap_is_empty(h) d... |
C | #include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <sys/sem.h>
union Semun{
int val;
struct semid_ds* buf;
unsigned short* array;
};
//创建并初始化信号量集
//nums 信号量的个数
//value 初始话的值
//成功:返回信号集id 失败:返回-1
int i_sem(int nsems, int value)
{
assert(nsems > 0);
//创建有nsems个信号量的信号量集
int semid = semget(IPC_PRI... |
C | /* SPDX-License-Identifier: MIT */
/*
* Copyright (c) 2008 Bo Berry
* Copyright (c) 2008-2011 Cisco Systems
*/
#include "safeclib_private.h"
#include "safe_str_constraint.h"
#include "safe_str_lib.h"
/**
* NAME
* strtok_s
*
* SYNOPSIS
* #include "safe_str_lib.h"
* char *
* strtok_s(char *des... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.