language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <string.h>
#include <system.h>
#include <screen.h>
/* Return the length of a NULL-terminated string */
int strlen(const char *text)
{
int counter=0;
if(text == NULL){
return -1;
}
for(counter=0; text[counter] != '\0'; counter++);
return counter;
}
char *strtok(const char* str,char token,unsigned int... |
C | #ifndef _DLIST_H_
#define _DLIST_H_
typedef struct _DListNode
{
void *data;
struct _DListNode *prev;
struct _DListNode *next;
}DListNode;
typedef struct _DList
{
DListNode *head;
DListNode *tail;
}DList;
typedef enum _Ret
{
RET_OK = 1,
RET_FAULT,
RET_OOM,
}Ret;
#define return_val_if_... |
C | #include <stdio.h>
#include <stdlib.h>
#include "Graph.h"
#include "Queue.h"
/*This function is implemented to print a path
*@param graph is a graph pointer
*@param s is source
*@param v is destnation
*/
void print_path(Graphptr graph, int s, int v)
{
if(v == s){
printf(" ");
}
if(graph->adjLists[v].pi == 0){... |
C | #include <curses.h>
#include <signal.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
static void finish(int sig);
static void showmenu(int index);
#define SLT_LEN 5
static int selected_num = 0;
static int selected_menus[SLT_LEN] = {-1,-1,-1,-1,-1};
static char *menus[] = {"Java", "C", "Python", "C++",... |
C | /*
Brayden Fidler
CPSC 111 Lab Fall 2016
Lab 8
Program take binary input and converts it to a decimal value
*/
#include <math.h>
#include <stdio.h>
#include <string.h>
int main(void) {
int decValue = 0;
char binaryString[25];
int sLength;
int i;
fprintf(stdout, "Enter a binary number (consists of 1s and 0s... |
C | /*******************************************************************************
* cmdline.c - Command line interface and logging
* Author: Oliver Douglas
* Target: STM32F051R8, using libopencm3
******************************************************************************/
#include "common.h"
extern SemaphoreHan... |
C | #include <stdio.h>
void preenche(int* vec, int n){
int i;
for (i=0;i<n;i++){
printf("insira o numero na posição de numero %d do vetor: \n", i);
scanf("%d", (vec+i));
}
printf("Vetor preenchido com sucesso\n");
}
float media(int* vec, int n){
int i,soma=0;
for (i=0;i<n;i++){
soma+=*(vec+i);
}
float med=(... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define NoSuchKey = -1;
typedef struct HashTable {
struct HashTable *next;
int key;
}ht;
void insertItem(ht *table, int M, int k) {
int v = k % M;
ht *newNode = NULL;
newNode = (ht *)malloc(sizeof(ht));
newNode->key = k;
newNode->next ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
//#include "hash_value.h"
#include "sqlite3.h"
#include "dev_db_mgr.h"
#define MAX_ID_NUMBER (20000)
//char max 8000 char
//varcahr var char max 8000 char
//nchar unicode, max 4000
//nvarchar var unicode, max 40... |
C | /* Write a program which accept string from user and copy capital characters of that string into another string.*/
#include<stdio.h>
#define ERRMEMORY -1
int CopyCapitalChar(char *arr, char *brr)
{
if(arr == NULL)
{
return ERRMEMORY;
}
while(*arr != '\0')
{
if((*arr>='A') && (*arr<='Z... |
C | #include <stdio.h>
#include <string.h>
#define ROM_LN 10
// prototypes //
// saisie du nombre romain
void saisir_rom(char *romain);
// convertit une seule lettre
int rom_to_dec(char c);
// convertit tout le nombre
unsigned long long int conversion(char *str);
// vrifie la validit du nombre romain
int verification (ch... |
C | /**
* Challenge 001
*/
#include <stdio.h>
int main(void) {
int r = 0, i = 1;
for (i = 1; i < 1000; i++) {
r += (((i % 3) == 0) || ((i % 5) == 0)) ? i : 0;
}
printf ("%i\n", r);
return 0;
}
|
C | #ifndef LINKLAYER_SEEN
#define LINKLAYER_SEEN
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <termios.h>
#include <stdio.h>
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
struct linkLayer{
char* serialPort;
int serialPortDescriber;
int role;
i... |
C | //flag
#include <limits.h>
#include <stdio.h>
int n;
int mDis(int dist[], int included[]) {
int min = INT_MAX, min_index;
for (int v = 0; v < n; v++)
if (included[v] == 0 && dist[v] <= min)
min = dist[v], min_index = v;
return min_index;
}
int solution(int dist[]) {
for... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <time.h>
#include <errno.h>
#include <string.h>
#include <sys/stat.h>
#include "log4c.h"
#define DFT_LOG_FLAG "0000"
struct log4c_globle_var {
char log_iniFile[64];
char log_flag[16];
char logFileName[64];
char logFileSuffix[64];
... |
C | /* Copyright (c) 2001-2018, The Ohio State University. All rights
* reserved.
*
* This file is part of the MVAPICH2 software package developed by the
* team members of The Ohio State University's Network-Based Computing
* Laboratory (NBCL), headed by Professor Dhabaleswar K. (DK) Panda.
*
* For detailed copyrigh... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
static void
max_heapify(int *ptr, int i, int size)
{
//printf("\nInside max heapify\n");
int largest = i;
int left = (2 * i) + 1;
int right = (2 * i) + 2;
int temp = 0;
if ((left < size) && ptr[i] < ptr[left])
largest = left;
if ((right < size) && p... |
C | #include "stm32f30x_conf.h"
#include <stdio.h>
#include <string.h>
#include "flash.h"
#include "lcd.h"
#include "30021_io.h"
int main(void)
{
init_usb_uart( 9600 ); /// Initialize USB serial emulation at 9600 baud
uint32_t address = 0x0800F800; /// Set address value to the last page... |
C | #include<stdio.h>
#include<conio.h>
void main()
{
int n,rem;
int i=2;
printf("enter value of n");
scanf("%d",&n);
while(i<=n)
{
rem=n%i;
if(rem==0)
{
printf(" prime number\n");
}
else
{
printf(" not prime number\n");
}
i++;
}
getch();
}
|
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<string.h>
#include<arpa/inet.h>
#include<stdlib.h>
#include<stdio.h>
#include<unistd.h>
#include<sys/socket.h>
#include<sys/types.h>
#include<netinet/in.h>
#include<fcntl.h>
#include<sys/stat.h>
int main()
{
int sockfd,retval,recvdbytes,sentbytes,PORT;
printf("PORT: ");
scanf("%d", &PORT);
struct sockaddr_... |
C |
/*
* main.c
*/
#include <stdlib.h>
#include <stdio.h>
#include "cache.h"
#include "main.h"
static FILE *traceFile;
int main(int argc, char **argv)
{
//pass by reference
printf("->Will execute parse_args \n");
parse_args(argc, argv);
printf("\n->Will execute init_cache");
init_cache();
printf("->Wil... |
C | #include <dlfcn.h>
#include "engeom.h"
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
int main()
{
void *handle;
char *err;
float srad, crad, cht;
FILE *outFile;
char outFileName[21];
char response;
//Define DLL pointers
void (*eng_sphere_d)(float, float*, float*);
floa... |
C |
/*
*****************************************************************
<GPL>
Copyright: © 2001-2015 Robert C Garvey
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the... |
C | /* Copyright (c) 2018-2022 UT Longhorn Racing Solar */
#include "BSP_I2C.h"
#include "stm32f4xx.h"
#include "stm32f4xx_gpio.h"
#include "stm32f4xx_rcc.h"
#include "stm32f4xx_i2c.h"
#define TIMEOUT_THRESHOLD 1200000 // 15 ms delay threshold (3x the write time)
/**
* @brief Initializes the I2C port that interface... |
C | /**
* \file CardTypes.h
* \author Timothy Choy - choyt2
* \brief CardTypes
* \date Mar 8, 2019
*/
#ifndef A3_CARD_TYPES_H_
#define A3_CARD_TYPES_H_
/**
* \brief Describes the rank of a card.
*/
typedef unsigned short int RankT;
/**
* \brief RankT for an Ace.
*/
#define ACE 1
/**
* \brief RankT for an Jack.... |
C | #include "TuLiPControl.h"
/* not implemented yet */
void abstract(Controller* controller)
{
return;
}
/* compute the control input u(k) and store it in controller.u */
void compute_control(Controller* controller)
{
Polytope* currentRegion = cartesian_prod(regions[controller->dRegion],input_bound);
Polytope* projG... |
C | /*************************************************************************
> File Name: 4_38.c
> Author: hepan
> Mail: hepansos@gmail.com
> Created Time: 2016年07月09日 星期六 11时29分05秒
************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
... |
C | // Listing 3.6 (zombie.c) Making a Zombie Process
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
// Function to be executed in the child process context
static void execute_child_process(pid_t cpid)
{
printf("Child - Process Id: %d\n", getpid());
... |
C | #include <stdio.h>
#include <stdlib.h>
#define CHAVE(L) ((L)->conteudo)
#define POST(L) ((L)->posterior)
typedef enum {ERROR, OK} status;
typedef enum {FALSE=0, TRUE=1 } bool;
typedef int dado;
typedef struct celula celula, *pilha;
struct celula
{
dado conteudo;
pilha posterior;
};
// Prototipos das funcoes.
... |
C | // average_intr.c
// ELEX7620 Lab 5 - Moving Average Filter
#include "audio.h"
#define LINEVOL 0x17 // 0dB config
#define OUTVOL 0x7F // +6dB config (corrects for -6dB attunation through board)
volatile int16_t audio_chR=0; //16 bits audio data channel right
volatile int16_t audio_chL=0; //16 bits audio data... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "libkalign.h"
int main(){
char *reads[] = {"TGAGAA","TGAGAA","TGAGAA","TGAGAAA","TGAGA"};
int num_reads = 0;
int i=0;
num_reads = sizeof(reads);
printf("size of reads: %d\n",num_reads);
char **p;
p = (char**)calloc(5,sizeof(char*));... |
C | //
// main.c
// list
//
// Created by HerryLo on 2019/10/20.
// Copyright © 2019年 HerryLo. All rights reserved.
//
// 线性结构:连续存储 数组
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
bool a = 1;
typedef struct ArrList {
int *p; // 数组第一个元素的地址
int len; // 数组长度
int cnt; // 数组元素的有效长度... |
C | #include "config.h"
#include "window.h"
#include "xquery.h"
#include "cache.h"
#include <unistd.h>
Window find_rat_window(Display *display) {
int num_screen = ScreenCount(display);
Window root, child;
int blah, i;
do {
for (i = 0; i < num_screen; i++)
if (XQueryPointer(display, Ro... |
C | int pass_col_up_rule(char board[4][4], int col, char expected_visible_boxes);
int pass_col_down_rule(char board[4][4], int col, char expected_visible_boxes);
int pass_row_left_rule(char row[4], char expected_visible_boxes);
int pass_row_right_rule(char row[4], char expected_visible_boxes);
int box_is_unique(char board[... |
C | #include<stdio.h>
int main()
{
int s, r, l1, l2;
printf("Enter S, R seperated by space : ");
scanf("%d %d", &s, &r);
// printf("%d", s);
int arr[s];
int ans[r];
printf("Enter Samples space seperated : ");
for(int i=0; i<s; i++)
scanf("%d", &arr[i]);
for(int j=0; j<r; j++)
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* findShifted.c :+: :+: :+: ... |
C | #include <stdio.h>
int main(){
int n;
scanf("%d", &n);
int s=1, i=1;
while(i<=2){
s=s*n;
i++;
}
printf("%d \n", s);
s=1;
i=1;
while(i<=3){
s=s*n;
i++;
}
printf("%d \n", s);
return 0;
}
|
C | #include<stdio.h>
void main(){
int a=20,b=30,c=10;
if(a>b){
if(a>c){
printf("a is greater\n");
}else{
printf("c is greater\n");
}
}else if(b>a){
if(b>c){
printf("b is greater\n");
}else{
printf("c is greater\n");
}
}else{
printf("c is greater\n");
}
}
|
C | /* Implemente a função “Primo” que recebe um número inteiro positivo como parâmetro e retorna 1
caso o número seja primo e 0, caso contrário. Por definição, um número é primo quando é divisível
somente por si próprio e por 1. */
int primo(int a){ // 0 para número não primo e 1 para número primo
int d=2;
if(a==1)
re... |
C | /*
* Autor: Rodrigo Corona
* Carne: 15102
* Fecha: 12 de marzo de 2020
*
* Descripcion: Libreria creada para configuracion y uso del PWM.
* Para mayor informacin, consultar la pagina 128 a la 131
* del manual del PIC16F887 (PWM mode).
*
*/
#include <pic16f887.h>
#define _XTAL... |
C | #include <MLV/MLV_all.h>
#include "serpent.h"
#include "affichage_serpent.h"
void afficher_quadrillage(Monde *mon)
{
int i;
/* On trace les lignes horizontales */
for (i = 0; i <= mon->n; i++) {
MLV_draw_line(0, i*TAILLE_CASE, mon->m*TAILLE_CASE, i*TAILLE_CASE, MLV_COLOR_BLACK);
}
/* On trace les lignes verti... |
C | #ifndef _ZIP_FILES_H_
#define _ZIP_FILES_H_
#include "miniz.h"
/// @brief Initializes a zip object to the zip file at filepath
/// @param zip Address to zip object to be initialized
/// @param filepath The filepath to a zip
/// @return mz_zip error code
int initZip(mz_zip_archive *zip, const char *filepath);
/// @bri... |
C | #include<stdio.h>
int main()
{
int ch = 0 ;
while((ch=getchar())!=EOF)
{
getchar();
if((ch=='A')||(ch=='a')||(ch=='E')||(ch=='e')||(ch=='I')||(ch=='i')||(ch=='O')||(ch=='o')||(ch=='U')||(ch=='u'))
{
printf("Vowel\n");
}
else
{
printf("C... |
C | /*
** EPITECH PROJECT, 2018
** N4S
** File description:
** parsing info
*/
#include <stdlib.h>
#include "unistd.h"
#include "n4s.h"
int parsing_info(t_info *info, char **tab)
{
info->h_left = (atof(tab[4]) + atof(tab[3])) / 2;
info->left = (atof(tab[12]) + atof(tab[13])) / 2;
info->mid = (atof(tab[19]) + atof(tab[... |
C | //
// Created by Nathan Baelen on 22/10/2019.
//
#include "stdio.h"
void pyramide() {
int i = 1;
int size = 7;
int j;
while (i < size) {
//espaces de début
for (int k = 0; k < size - i; ++k) printf(" ");
//ligne croissante
for (int k = 1; k < i; k++) printf("%d ", k)... |
C | #include<stdio.h>
#include<stdlib.h>
typedef struct Node{
int key;
struct Node *left;
struct Node *right;
}node;
void max(node *root)
{
if(root->right!=NULL)
max(root->right);
else printf("%d\n",root->key);
}
void min(node *root)
{
if(root->left!=NULL)
min(root->left);
else printf("%d\n",root->key);
}
vo... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <time.h>
#include "graph.h"
Graph * graph_new(){
Graph * graph = (Graph *)calloc(1, sizeof(Graph));
if (!graph) return NULL;
graph->size = 0;
graph->list = NULL;
return graph;
}
void graph_delete(Graph * gr... |
C | /**
* OperandG24.c: This file is used to decode the following operands: LDR & STR
* ECED 3403
* 21 August 09
*/
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <math.h>
#include "Output_File.h"
#include "Chk_SRec.h"
//converts an input binary array to its decimal equivalent
int bina... |
C | /*
* tinyPulse.c
*
* Created: 02.07.2019 13:14:50
* Author: Elias Lundheim
*/
#include <stdbool.h>
#include <stdint.h>
#include "tinyTime/tinyTime.h"
#include "settings.h"
/*
The tinyPulse keeps track of two things. The first is whether or not the neuron is in
pulseMode. If the neuron is in pulse mode, it shou... |
C | { This is an iterative approach to n! }
begin
variable n;
variable result;
variable count;
n := 10;
result := 1;
count := 1;
while n <> count do
begin
count := count + 1;
result := result * count
end;
print n;
print "! = ";
print result;
print "\n... |
C | #include <stdio.h>
#include "mylib.h"
char *my_index(const char *s, int c){
while(*s != '\0'){
if(*s == c){
return (char *) s;
}
s +=1;
}
return 0;
}
int my_strcasecmp(const char *s1, const char *s2){
int scase = 0;
while((*s1 != '\0') | (*s2 != '\0')){
if(*s1 >= 'A' && *s1 <= 'Z'){... |
C | #define _POSIX_C_SOURCE 200809L
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <inttypes.h>
#include <math.h>
#include <time.h>
const char* getVarName(const char *src, const char *startDelim,
const char *endDelim)
{
static char var_name[256];
char *s... |
C | #include "LKH.h"
#include "Heap.h"
/*
* The ReadProblem function reads the problem data in TSPLIB format from the
* file specified in the parameter file (PROBLEM_FILE).
*
* The following description of the file format is extracted from the TSPLIB
* documentation.
*
* The file consists of a specificati... |
C | // ---- Commmon definitions for singly-linked list examples ----
#include <vcc.h>
#include <stdlib.h>
typedef
/*D_tag node */
struct node {
int key;
struct node * next;
} SNnode;
/*D_defs
define pred sll^(x):
(
((x l= nil) & emp) |
((x |-> loc next: nxt) * sll^(nxt))
) ;
define set-fun keys^(x):
... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "structinfo.h"
Vara *Read (void) {
Vara *varapointer = (Vara *)calloc(100,sizeof(Vara));
char *tok;
char envara[256];
char delim[] = ",";
Vara *startvara = varapointer;
FILE *fp;
if ((fp = fopen("varor.csv", "r")) == NULL) {
fprint... |
C | #ifndef ARM_INCLUDE
#define ARM_INCLUDE
#include "versatile_pb.h"
// trap frame: in ARM, there are seven modes. Among the 16 regular registers,
// r13 (sp), r14(lr), r15(pc) are banked in all modes.
// 1. In xv6_a, all kernel level activities (e.g., Syscall and IRQ) happens
// in the SVC mode. CPU is put in different... |
C | void filtrarRequisicoes(){
size_t len = 0;
char linha [1024];
ssize_t chars;
int whitelisted = 0;
//Abrir arquivo de whitelist
FILE *whitelist;
whitelist = fopen("whitelist.txt", "r");
//Percorrendo linha por linha do arquivo
while (fgets(linha, siz... |
C | #include "libft.h"
/*
** -------------------------------------------------------------------------- +
** Sorts the given array of char-pointers by ASCII value (lowest to highest).
** -------------------------------------------------------------------------- +
*/
void ft_arrsort(char **arr)
{
char *tmp;
int len;
i... |
C | #include <stdio.h>
#include <stdlib.h>
#include "lib.h"
int main()
{
char seguir='s';
int opcion=0;
int flagNumUno = 0;
int flagNumDos = 0;
int primerNumero;
int segundoNumero;
float resultado;
while(seguir=='s')
{
printf("***********************************************\n... |
C | /*
Ideas --
1. Reverse the list and print first k nodes.
2. Recursively iterate the list and while returning print the nodes, keep track the number of nodes.
3. Have all nodes in stack and pop k nodes.
4. find out the kth node from last and from here last k nodes can be printedin reverse order.
*/
//Implemented 2nd o... |
C | #include <stdio.h>
#include <string.h>
int main(void)
{
char str[32];
int i;
int count1 = 0;
int count2 = 0;
while(scanf("%s", str) == 1) {
int vow = 0;
int repeat = 0;
if (strstr(str, "ab"))
goto part2;
if (strstr(str, "cd"))
goto part2;
if (strstr(str, "pq"))
goto part2;
if (strstr(str, "x... |
C | /*
* File: myutildefsc.c
* Author: Saurabh
*
* Created on 6 July, 2015, 1:35 AM
*/
#include "myutils.h"
/*
*
*/
#define def_funcs(sizeid, typeid, sub) \
sizeid##DArr_##typeid brute_force_primes_##typeid(sub max) { \
sub i, j; \
sizeid##DArr_##typeid res = initialize##sizeid##... |
C | #include <stdio.h>
#include "lab11Rect.h"
int main() {
double x, y, width, height, angle;
scanf("%lf %lf %lf %lf %lf",&x, &y, &width, &height, &angle);
Rect* rect = createRect(x,y,width,height,angle);
printf("Rectangle square is: %lf\n",getRectSquare(rect));
printf("Rectangle perimeter is: %lf\... |
C | #include<stdio.h>
#include<string.h>
void output(char ch[])
{
int i=0;
while(ch[i]!='\0')
{
if(ch[i]>='A'&&ch[i]<='E'){
ch[i]+=26;
printf("%c",ch[i]-5);
}
else if(ch[i]>'E'&&ch[i]<='Z')
printf("%c",ch[i]-5);
else
printf("%c",ch[i]);
i++;
}
}
int ... |
C | /*
217. Contains Duplicate
Given an array of integers, find if the array contains any duplicates. Your
function should return true if any value appears at least twice in the array,
and it should return false if every element is distinct.
*/
// 12 ms
int compare (const void * a, const void * b)
{
return ( *(int*)a ... |
C | /************************************************************************/
/* ,Ҫʹַʽ
1>ʹúλ
2>ʹλ
s eee eeee e ddd dddd dddd dddd dddd dddd
1 000 0000 0 000 0000 0000 0000 0000 0000 SIGN
0 111 1111 1 000 0000 0000 0000 0000 0000 EXP
0 000 0000 0 111 1111 1111 1111 1111 1111 fract... |
C | #include <stdio.h>
#include <stdlib.h>
struct Node{
int data;
struct Node* next;
};
void push(struct Node** head_ref, int data){
struct Node* newNode = (struct Node*)malloc(sizeof(struct Node));
newNode -> data = data;
newNode -> next = *head_ref;
*head_ref = newNode;
}
void printList(struct Nod... |
C | #include <global.h>
void erro(int err)
{
switch(err) {
case ERR_VARGRANDE:
perro("Variável muito grande"); break;
case ERR_SINTAXE:
perro("Erro de sintaxe"); break;
case ERR_TABSIMCHEIA:
perro("Tabela de símbolos cheia"); break;
case ERR_ARRLEXCHEIO:
perro("Array de lexemas cheio"); break;
defau... |
C | #include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <softPwm.h>
#include <wiringPi.h>
#define U 26
#define D 28
void playSound(int choice) {
char * arg[3] = {"mpg321","22311", NULL};
if(choice!=0) {
arg[1] = "20712";
}
int ret = fork(); //create a child
if (ret < 0) {
... |
C | #include <stdlib.h>
#include <string.h>
#include <stdio.h>
#define MIN_sublist_SIZE 8
#define STACK_SIZE 66
void display(int list[], int length)
{
int i;
printf(">");
for (i = 0; i < length; i++)
{
printf(" %d", list[i]);
}
printf("\n");
}
typedef struct {
int *index;
int lengt... |
C | #ifndef OPTION1_H_INCLUDED
#define OPTION1_H_INCLUDED
void getpassword()
{
print();
printf("\n\n\t\t\t\t 룺");
char pass[30];
scanf("%s",pass);
if(!strcmp(pass,password))
{
option();
}
else
{
printf("\n\t\t\t\t ");
Sleep(1200);
getpassword();
}
}
void getregi()
{
char patID[30];
/*******ϵͳʱ*******... |
C | #define _POSIX_C_SOURCE 200809L
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <mrsh/builtin.h>
#include <mrsh/parser.h>
#include <mrsh/shell.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "builtin.h"
#include "shell/path.h"
static const char source_usage[] = "usage: . <pat... |
C | #include "base/BLptrq.h"
#include "base/BLbase.h"
#include "base/BLarray1D.h"
#include <memory.h>
#define QSIZE 4
#define ARRAY1D_SIZE 8
static int ptrq_new_delete();
static int ptrq_putany_getany();
// whole test sequence
int ptrq()
{
int err = EXIT_SUCCESS;
do {
if (EXIT_SUCCESS != (err = ptrq_... |
C | #include <app_cfg.h>
#if APP_CFG_TRACE_LEVEL != TRACE_LEVEL_OFF
#include <stdio.h>
#include <stdarg.h>
/*
This function is called to print Application-specific Trace in uC-USB and
uC-FS.
The application can change the contents of the function but cannot change
its name or prototype
*/
int adi_app_pri... |
C | /*question number 10*/
#include<stdio.h>
void main()
{
float a,b,c,d;
printf("enter the numbers:");
scanf("%f%f%f",&a,&b,&c);
printf("line: %fx + %fy + %f",a,b,c);
d=-c/a;
printf("\n point of intersection: (%0.2f,0)",d);
}
|
C | #include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
struct *void block {
void *block next;
//num of bytes in the block
int size;
//check if free
int flag;
}
int main(void)
{
printf("malloc: %d\n", malloc(3));
printf("calloc: %d\n", calloc(3, 5));
}
void* my_malloc(int num) {
return sbrk(num);
}
vo... |
C | #include <u.h>
#include <libc.h>
void itob(int n, char *s, int b);
void itoh(int n, char *s);
void reverse(char *s);
int
main(int argc, char **args)
{
print("KR 3-5\n");
int val = 79;
char hexs[128];
itob(val, hexs, 8);
print("%s\n", hexs);
print("after function call\n");
return 0;
}
void itob(int n, char *s,... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* read2.c :+: :+: :+: ... |
C | #include <header.h>
void suma (char cont1[], int nro1)
{
double s1=0,s2=0,s3;
char *aux1, *aux2;
aux1=&cont1[nro1-1];
aux2=&cont1[nro1+1];
s1=atof(aux1); //, cont[i+1])
s2=atof(aux2);
s3=s1+s2;
printf("El valor de la suma de %2.2f + %2.2f = %2.2f \n",s1,s2,s3);
}
void resta (char cont2[]... |
C | /*************************************************************************
> File Name: 3.c
> Author:
> Mail:
> Created Time: 2020年07月15日 星期三 16时27分22秒
************************************************************************/
#include<stdio.h>
#include<sys/types.h>
#include<unistd.h>
#include<stdlib.h>
int main... |
C | //#include <stdio.h>
//int main()
//{
// int a = 0;
// for (a = 1000; a <= 2000; a++)
// {
// if (a % 100 == 0 && a % 4 == 0)
// {
// printf("%d ", a);
// }
// if (a % 400 == 0)
// {
// printf("%d ", a);
// }
// }
// return 0;
//}
//#include <stdio.h>/*nt main()
//{
// int a = 0;
// int b = 0;
// for (a = 100... |
C | #include<stdlib.h>
#include<stdio.h>
#include <string.h>
typedef struct anode {
char *name;
struct anode *r, *l;
} node;
contains(tree, q)
node **tree;
char *q;
{
if(!(*tree)) return;
if ( strcmp((*tree)->name, q) == 0) printf("yes\n");
contains(&(*tree)->l, q);
contains(&(*tree)->r, q);
}
delete(tree){
i... |
C | /*
* display.c
*
* Created on: May 15, 2021
* Author: jbaumann
*
* This file contains the source code for the low-level handling of the display.
* Different display types can be defined programmatically and added to the
* array display_definitions, and the user can select from these by setting a
* co... |
C | #include <stdio.h>
int main() {
int n = 1, n_par = 0, n_impar = 0;
double s_par = 0, s_impar = 0, media_par, media_impar;
while (n!=0) {
scanf("%d", &n);
if(n%2 == 0){ // n é par
s_par += n;
n_par++;
if(n==0) n_par--;
}
else{
... |
C | //
// main.c
// Star_2
//
// Created by James Choi on 2020/07/07.
// Copyright © 2020 James Choi. All rights reserved.
//
#include <stdio.h>
int main(){
int N;
scanf("%d", &N);
for(int i=0; i< 2*N; i++){
if((i%2) ==0){
for(int j=0; j<N; j++){
if((j%2)==0)
... |
C | #include "mach_o.h"
static bool is_ran_off_already_in_ranlibs(t_mach_o *file,
struct ranlib *ranlib,
uint64_t index)
{
uint64_t i;
i = 0;
if (!file->ranlibs || index > file->nran)
return (false);
while (i < index)
{
if (file->ranlibs[i].ran_off == ranlib->ran_off)
return (true);
i++... |
C | #include <stdio.h>
#include <string.h>
#include "mpi.h"
int main(int argc, char *argv[])
{
int my_rank;
int p;
int tag = 0;
MPI_Status status;
int globalArr[] = {1, 4, 5, 7, 0, -1, 1000, 34, 56, 0, 777777};
int portion, rem, *localArr, localMax, finalRes;
MPI_Init(&argc, &argv);
MPI_Com... |
C | #include "fish-stack.h"
#include "fish-codebox.h"
#include <stdio.h>
/* initial amount of space on the stack, in items */
#define FISH_INITIAL_STACK_SIZE (128)
/* bytes needed to store items: 1 (identifier) + 8 (value) */
#define STACK_SIZE(items) (FISH_STACK_ITEM_SIZE * (items))
/* allocate a new stack structure wi... |
C | //Print a multiplication table of input number.
#include<stdio.h>
int main()
{
int i,x;
printf("enter :");
scanf("%d",&x);
for(i=1;i<=10;i++)
{
printf("%d*%d=%d\n",x,i,x*i);
}
return 0;
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <tcpmgr.h>
#include <tcpmgr_private.h>
#include <tcpmgr_sock.h>
#define DEBUG
#include <debug.h>
#define SERVER_LOG "server.log"
void client_task(void* arg, int socket, tcpmgr_info_t cInfo);
tcpmgr_t mgr = NULL;
int main()
{
... |
C | // TAD para Lista Dinâmica Encadeada baseado no livro "Estrutura de dados descomplicada em lingugem C (André Backes)"
#include <stdio.h>
#include <stdlib.h>
#include "pilhaEncadeada.h"
// definição do struct elemento
typedef struct elemento{
char dado;
struct elemento *prox;
}Elemento;
// função para alocar memó... |
C | /*
UNIVERSIDADE FEDERAL DO CEARÁ
CAMPUS SOBRAL
CURSO DE ENGENHARIA DE COMPUTÇÃO
ALGORITMOS E GRAFOS
SAMUEL HERICLES - 389118
Objetivo -> Fazer um verificar de grafos isomorfos.É preciso de
pelo ... |
C | //
// Search Table.c
// calendar
//
// Created by Bruno Chroniaris on 11/5/14.
// Copyright (c) 2014 UNIUM automação. All rights reserved.
//
#include "Search Table.h"
//TADs
struct sTable
{
EventBinarySearchTree *table[SearchTableSize];
};
//Functions
SearchTable* createEmptySearchTable (void)
{
Searc... |
C | #include <stdio.h>
#include <sys/mman.h>
#include <sys/stat.h> /* For mode constants */
#include <fcntl.h> /* For O_* constants */
#include <unistd.h>
#include <sys/types.h>
int *count_consumer;
int main(int argc, char const *argv[])
{
int shmfd;
shmfd = shm_open("/cdacshm", O_RDWR | O_CREAT... |
C | /**
* Copyright 2014 University Corporation for Atmospheric Research. All rights
* reserved. See the the file COPYRIGHT in the top-level source-directory for
* licensing conditions.
*
* @file Grib2Parser.c
*
* This file defines the API for parsing a GRIB edition 2 message.
*
* Functions in this module are thre... |
C | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include "Queue_arr.h"
Tnode* CreateTreeNode(tree_type value)
{
Tnode *temp = (Tnode*)calloc(1, sizeof(Tnode));
temp->key = value;
return temp;
}
Tnode* CreateBST()
{
Tnode *mytree = NULL;
tree_type num = 0;
printf("\nEnter numbers to tree... |
C | /**
* Note: The returned array must be malloced, assume caller calls free().
* DحnD:
* Given the array nums, for each nums[i] find out how many numbers in the array are smaller than it.
* That is, for each nums[i] you have to count the number of valid j's such that j != i and nums[j] < nums[i].
* Return the answer... |
C | /*
** EPITECH PROJECT, 2020
** NWP_myftp_2019
** File description:
** dele
*/
#include "myftp.h"
int cmd_dele(int client_fd, global_t *glob, char **command)
{
client_t *client = list_get_client(glob->clients, client_fd);
struct stat sb;
if (!check_client(client_fd, client, false))
return (84);
... |
C | void main()
{ int a[26],i,n,t=0;
char b[300];
for(i=0;i<26;i++) a[i]=0;
gets(b);
n=strlen(b);
for(i=0;i<n;i++)
{ if(b[i]-97>=0&&b[i]-97<=25) a[b[i]-97]++;}
for(i=0;i<26;i++)
{ if(a[i]!=0) {printf("%c=%d\n",i+97,a[i]);t++;}}
if(t==0) printf("No");
scanf("%d",&n);
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.